Пример #1
0
        bool IRadicalYieldInstruction.Tick(out object yieldObject)
        {
            switch (_state)
            {
            case OperationState.Inactive:
                if (_routine != null && SPThreadPool.QueueUserWorkItem(this.AsyncWorkerCallback))
                {
                    _state      = OperationState.Initializing;
                    yieldObject = null;
                    return(true);
                }
                else
                {
                    yieldObject = null;
                    return(false);
                }

            case OperationState.Initializing:
            case OperationState.RunningAsync:
                yieldObject = null;
                return(true);

            case OperationState.WaitingOnYield:
                yieldObject = _yieldObject;
                this.Clear();
                return(true);

            default:
                yieldObject = null;
                return(false);
            }
        }
        private static SPThreadPool CreateInstance()
        {
            if (object.ReferenceEquals(_instance, null))
            {
                _instance = Singleton.CreateSpecialInstance<SPThreadPool>("Spacepuppy.SPThreadPool", SingletonLifeCycleRule.LivesForever);
            }

            return _instance;
        }
        private static SPThreadPool CreateInstance()
        {
            if (object.ReferenceEquals(_instance, null))
            {
                _instance = Singleton.CreateSpecialInstance <SPThreadPool>("Spacepuppy.SPThreadPool", SingletonLifeCycleRule.LivesForever);
            }

            return(_instance);
        }
        private static SPThreadPool CreateInstance()
        {
            if (object.ReferenceEquals(_instance, null))
            {
                var go = new UnityEngine.GameObject("Spacepuppy.SPThreadPool");
                _instance = go.AddComponent<SPThreadPool>();
                UnityEngine.Object.DontDestroyOnLoad(go);
            }

            return _instance;
        }
        private static SPThreadPool CreateInstance()
        {
            if (object.ReferenceEquals(_instance, null))
            {
                var go = new UnityEngine.GameObject("Spacepuppy.SPThreadPool");
                _instance = go.AddComponent <SPThreadPool>();
                UnityEngine.Object.DontDestroyOnLoad(go);
            }

            return(_instance);
        }