public static void Release(ThreadPoolSystemActionWrapper wrapper) { wrapper._action = null; if (Pool.Count >= 10000) { return; } Pool.Push(wrapper); }
public static IAction Wrap(Action action) { if (!Pool.TryPop(out var wrapper)) { wrapper = new ThreadPoolSystemActionWrapper(); } wrapper._action = action; return(wrapper); }
public void Schedule(Action action) { Schedule(ThreadPoolSystemActionWrapper.Wrap(action)); }