2using System.Collections.Generic;
17 ManualResetEvent m_evtReady =
new ManualResetEvent(
false);
18 ManualResetEvent m_evtAbort =
new ManualResetEvent(
false);
19 object m_syncObj =
new object();
20 List<T> m_rgData =
new List<T>();
29 m_evtCancel = evtCancel;
53 get {
return m_nDataCount; }
62 public bool GetAt(
int nIdx, ref T t)
66 if (m_evtCancel ==
null)
69 WaitHandle[] rghCancel = m_evtCancel.Handles;
71 if (m_evtReady ==
null || m_evtAbort ==
null)
74 ManualResetEvent evtReady = m_evtReady;
75 ManualResetEvent evtAbort = m_evtAbort;
77 List<WaitHandle> rgWait =
new List<WaitHandle>();
78 rgWait.AddRange(rghCancel);
82 int nWait = WaitHandle.WaitAny(rgWait.ToArray());
83 if (nWait < rgWait.Count - 1)
119 if (m_evtReady !=
null)
122 m_nDataCount = m_rgData.Count;
140 WaitHandle[] rghCancel = m_evtCancel.Handles;
142 if (m_evtCancel ==
null || m_evtAbort ==
null)
145 ManualResetEvent evtAbort = m_evtAbort;
146 ManualResetEvent evtReady = m_evtReady;
148 List<WaitHandle> rgWait =
new List<WaitHandle>();
149 rgWait.AddRange(rghCancel);
150 rgWait.Add(evtAbort);
151 rgWait.Add(evtReady);
153 int nWait = WaitHandle.WaitAny(rgWait.ToArray());
154 if (nWait < rgWait.Count - 1)
163 m_rgData.RemoveAt(0);
164 m_nDataCount = m_rgData.Count;
181 if (m_evtReady ==
null)
184 if (m_evtCancel.WaitOne(0))
201 protected virtual void Dispose(
bool bDisposing)
203 if (m_evtAbort !=
null)
207 m_evtAbort.Dispose();
211 if (m_evtReady !=
null)
213 m_evtReady.Dispose();
The CancelEvent provides an extension to the manual cancel event that allows for overriding the manua...
The BlockingQueue is used for synchronized Queue operations.
bool Pop(ref T t)
Remove an item from the front of the queue.
BlockingQueue(CancelEvent evtCancel)
The BlockingQueue constructor.
virtual void Dispose(bool bDisposing)
Release all resources used by the queue.
void Reset()
Reset the abort event.
bool Peek(ref T t)
Retrieve an item from the front of the queue, but do not remove it.
void Abort()
Cancel the blocking queue operations.
void Clear()
Remove all items from the queue.
bool GetAt(int nIdx, ref T t)
Returns the item at a given index within the queue.
void Push(T t)
Add an item to the back of the queue.
void Dispose()
Release all resources used by the queue.
int Count
Return the number of items in the queue.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.common namespace contains common MyCaffe classes.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...