예제 #1
0
        public static void Release(ThreadPoolSystemActionWrapper wrapper)
        {
            wrapper._action = null;
            if (Pool.Count >= 10000)
            {
                return;
            }

            Pool.Push(wrapper);
        }
예제 #2
0
        public static IAction Wrap(Action action)
        {
            if (!Pool.TryPop(out var wrapper))
            {
                wrapper = new ThreadPoolSystemActionWrapper();
            }

            wrapper._action = action;
            return(wrapper);
        }
예제 #3
0
 public void Schedule(Action action)
 {
     Schedule(ThreadPoolSystemActionWrapper.Wrap(action));
 }