Example #1
0
        public static void AddAction(PlayerLoopTiming timing, IPlayerLoopItem action)
        {
            var runner = runners[(int)timing];

            if (runner == null)
            {
                ThrowInvalidLoopTiming(timing);
            }
            runner.AddAction(action);
        }
Example #2
0
        public void Start(IPlayerLoopItem runner)
        {
            thread = new Thread(() =>
            {
                Thread.Sleep(30);
                while (runner.MoveNext())
                {
                    Thread.Sleep(30);
                }
            });

            thread.Start();
        }
        public void Dispatch(IPlayerLoopItem item)
        {
            if (Interlocked.CompareExchange(ref running, 1, 1) == 1)
            {
                lock (waitingGate)
                {
                    waitingQueue.Enqueue(item);
                    return;
                }
            }

            lock (runningGate)
            {
                runningQueue.Enqueue(item);
            }
        }
		public void AddAction(IPlayerLoopItem item) {
			lock (runningAndQueueLock) {
				if (running) {
					waitQueue.Enqueue(item);
					return;
				}
			}

			lock (arrayLock) {
				// Ensure Capacity
				if (loopItems.Length == tail) {
					Array.Resize(ref loopItems, checked(tail * 2));
				}

				loopItems[tail++] = item;
			}
		}
Example #5
0
 public static void AddAction(PlayerLoopTiming timing, IPlayerLoopItem action)
 {
     runners[(int)timing].AddAction(action);
 }
Example #6
0
 public static void Dispatch(PlayerLoopTiming timing, IPlayerLoopItem item)
 {
     Runners[(int)timing].Dispatch(item);
 }