You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is necessary because we will always deadlock if a thread takes on multiple pump tasks since pump tasks never return.
This means when using separate threads for certain systems (like physics or rendering), we need to be sure that there are enough threads to have at least one per system (to ensure forward progress).
print_verbose(vformat("A greater number of dedicated threads were requested (%d) than threads available (%d). Please increase the number of available worker task threads. Recovering this session by spawning more worker task threads.", pump_task_count + 1, thread_count)); // +1 because we want to keep a Thread without any pump tasks free.
366
+
367
+
Thread::Settings settings;
368
+
#ifdef __APPLE__
369
+
// The default stack size for new threads on Apple platforms is 512KiB.
370
+
// This is insufficient when using a library like SPIRV-Cross,
371
+
// which can generate deep stacks and result in a stack overflow.
372
+
#ifdef DEV_ENABLED
373
+
// Debug builds need an even larger stack size.
374
+
settings.stack_size = 2 * 1024 * 1024; // 2 MiB
375
+
#else
376
+
settings.stack_size = 1 * 1024 * 1024; // 1 MiB
377
+
#endif
378
+
#endif
379
+
// Re-sizing implies relocation, which is not supported for this array.
380
+
CRASH_COND_MSG(thread_count + 1 > (int)threads.get_capacity(), "Reserve trick for worker thread pool failed. Crashing.");
WorkerThreadPool::TaskID tid = WorkerThreadPool::get_singleton()->add_task(callable_mp(this, &PhysicsServer3DWrapMT::_thread_loop), true);
78
+
WorkerThreadPool::TaskID tid = WorkerThreadPool::get_singleton()->add_task(callable_mp(this, &PhysicsServer3DWrapMT::_thread_loop), true, "Physics server 3D pump task", true);
0 commit comments