public void StartCoroutine(PausableTask task) { paused = false; _newTaskRoutines.Enqueue(task); MemoryBarrier(); if (_isAlive == false) { _isAlive = true; MemoryBarrier(); #if NETFX_CORE IAsyncAction asyncAction = ThreadPool.RunAsync ((workItem) => { RunCoroutineFiber(); _isAlive = false; stopped = false; Interlocked.MemoryBarrier(); }); #else ThreadPool.QueueUserWorkItem((stateInfo) => //creates a new thread only if there isn't any running. It's always unique { RunCoroutineFiber(); _isAlive = false; stopped = false; MemoryBarrier(); }); #endif } }
public TaskRoutine CreateTask(IEnumerator task) { if (task == null) return null; PausableTask ptask = new PausableTask(task, _runner); return new TaskRoutine(ptask); }
public void StartCoroutine(IEnumerator task) { stopped = false; paused = false; PausableTask stask; if (task is PausableTask) stask = task as PausableTask; else stask = new PausableTask(task, this); //ptask uses a single task internally Thread oThread = new Thread(new ThreadStart(() => { while (stask.MoveNext() == true); })); oThread.IsBackground = true; oThread.Priority = _priority; oThread.Start(); }
public void StartCoroutine(IEnumerator task) { stopped = false; paused = false; if (_component == null) if (MonoTaskBehaviour.isQuitting == false) Init(); else return; PausableTask stask; if (task is PausableTask) stask = task as PausableTask; else stask = new PausableTask(task, this); //ptask uses a single task internally _component.gameObject.SetActive(true); _component.enabled = true; _component.StartCoroutine(stask); }
internal TaskRoutine(PausableTask task) { _task = task; }
public void StartCoroutineThreadSafe(PausableTask task) { StartCoroutine(task); }