예제 #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();
 }