Add MAIN_THREAD_ONLY compilation