예제 #1
0
        // Post a work item and wait for it to be processed
        // Return true if the item was processed w/in 2 sec else false
        internal bool PostSyncWorkItem(QueueItem workItem)
        {
            Debug.Assert(!_quitting, "Can't add items to queue when quitting");
            SyncQueueItem syncItem = new SyncQueueItem(workItem);

            _q.Enqueue(syncItem);
            _ev.Set();
            return(syncItem._ev.WaitOne(2000, false));
        }
 // Post a work item and wait for it to be processed
 // Return true if the item was processed w/in 2 sec else false
 internal bool PostSyncWorkItem(QueueItem workItem)
 {
     Debug.Assert(!_quitting, "Can't add items to queue when quitting");
     SyncQueueItem syncItem = new SyncQueueItem(workItem);
     _q.Enqueue(syncItem);
     _ev.Set();
     return syncItem._ev.WaitOne(2000, false);
 }