| 58 | |
| 59 | #ifdef THREADS_ENABLED |
| 60 | void Thread::callback(ID p_caller_id, const Settings &p_settings, Callback p_callback, void *p_userdata) { |
| 61 | Thread::caller_id = p_caller_id; |
| 62 | if (platform_functions.set_priority) { |
| 63 | platform_functions.set_priority(p_settings.priority); |
| 64 | } |
| 65 | if (platform_functions.init) { |
| 66 | platform_functions.init(); |
| 67 | } |
| 68 | ScriptServer::thread_enter(); // Scripts may need to attach a stack. |
| 69 | if (platform_functions.wrapper) { |
| 70 | platform_functions.wrapper(p_callback, p_userdata); |
| 71 | } else { |
| 72 | p_callback(p_userdata); |
| 73 | } |
| 74 | ScriptServer::thread_exit(); |
| 75 | if (platform_functions.term) { |
| 76 | platform_functions.term(); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | Thread::ID Thread::start(Thread::Callback p_callback, void *p_user, const Settings &p_settings) { |
| 81 | ERR_FAIL_COND_V_MSG(id != UNASSIGNED_ID, UNASSIGNED_ID, "A Thread object has been re-started without wait_to_finish() having been called on it."); |
no test coverage detected