/// <summary> /// Spawns a dedicated thread to run the passed task. /// Once the task is completed, the Thread will be recycled. /// </summary> /// <param name="task">The task to run on the thread as it starts.</param> internal void SpawnDedicatedThread( ITask task ) { System.Threading.Thread sys_thread = new System.Threading.Thread(( ) => { try { Thread t = new Thread(); lock ( threadLock ) dedicatedThreads.Add(t); t.StartTask(task); t.StartThread(); } catch ( Exception e ) { Hikari.ScheduleUnity(( _ ) => { throw e; }); } }); sys_thread.IsBackground = true; sys_thread.Start(); }