AGENT.Contrib.Util.ThreadUtil.SafeQueueWorkItem C# (CSharp) Метод

SafeQueueWorkItem() публичный статический Метод

Queues an action into the threadpool
public static SafeQueueWorkItem ( ThreadStart start ) : void
start ThreadStart
Результат void
        public static void SafeQueueWorkItem(ThreadStart start)
        {
            lock (lockObject)
            {
                _threadActions.Enqueue(start);

                // if we haven't spun all the threads up, create a new one
                // and add it to our available threads

                if (_availableThreads.Count < MaxThreads)
                {
                    var t = new Thread(ActionConsumer);
                    _availableThreads.Add(t);
                    t.Start();
                }

                // pulse all waiting threads
                _threadSynch.Set();
            }
        }