ae564feb2a
When the main thread is waiting on a worker thread pool via WorkerThreadPool::wait_for_group_task_completion() the MessageQueue is no longer being serviced. But in ResourceLoader::_load_complete_inner we need to be able to push a callable onto the MessageQueue and we wait until completion. Effectively waiting on the main thread to run our code. If the tasking waiting on completion is in the group the main thread is waiting for then this can never happen. We solve this problem by servicing the MessageQueue in the WorkerThreadPool if main thread is waiting. To avoid busy waiting on the semaphore we sleep for a very brief time to spare battery without impacting latency too much in the waiting case.