Improved test for main thread.