| 394 | } |
| 395 | } |
| 396 | bool TaskManager::_dispatch_to_main_thread(std::shared_ptr<BaseMainThreadDispatchData> p_data) { |
| 397 | if (Thread::is_main_thread()) { |
| 398 | p_data->callback(); |
| 399 | return p_data->is_canceled(); |
| 400 | } |
| 401 | while (!main_thread_dispatch_queue.try_push(p_data)) { |
| 402 | OS::get_singleton()->delay_usec(10000); // wait for a slot to become available |
| 403 | } |
| 404 | p_data->wait_for_completion(); |
| 405 | return p_data->is_canceled(); |
| 406 | } |
| 407 | |
| 408 | void TaskManager::process_main_thread_dispatch_queue_for(int64_t time_usec) { |
| 409 | if (!Thread::is_main_thread()) { |
nothing calls this directly
no test coverage detected