示例#1
0
 public void ReleaseThread(ThreadObject threadObject)
 {
     lock (_lock) {
         _threads.Add(threadObject);
     }
     _threadReleasedEvent.Set();
 }
示例#2
0
 private void ExecuteTaskAndReleaseThread(ThreadObject thread, Action task)
 {
     try {
         task();
     }
     catch (Exception e) {
         // TODO(rpaquay): Do we want to propage the exception here?
         Logger.LogException(e, "Error executing task on custom thread pool.");
     }
     finally {
         ReleaseThread(thread);
     }
 }
示例#3
0
        private void ProcessQueueAndReleaseThread(ThreadObject thread)
        {
            try {
                ProcessQueue();
            } finally {
                ReleaseThread(thread);
            }

            // There may have been more items enqueued concurrently: Mote tasks may have been
            // enueue we may have been
            // releasing the thread while
            // schedule another queue processing if needed
            bool queueIsEmpty;

            lock (_queueLock) {
                queueIsEmpty = _taskQueue.Count == 0;
            }
            if (!queueIsEmpty)
            {
                ProcessQueueAsync();
            }
        }
示例#4
0
 private void ReleaseThread(ThreadObject thread)
 {
     thread.Release();
 }
示例#5
0
 public void ReleaseThread(ThreadObject threadObject) {
   lock (_lock) {
     _threads.Add(threadObject);
   }
   _threadReleasedEvent.Set();
 }