diff options
author | Henri Herscher <henri@oreka.org> | 2005-11-15 04:19:31 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2005-11-15 04:19:31 +0000 |
commit | 7653151cb08cfa40eec22e7aac3068b009207bc8 (patch) | |
tree | c41e2f1bbf73001791248fb18d842a01978ad0e8 /orkaudio/ThreadSafeQueue.h | |
parent | 61cb474c09cce3a667774c4f4eef093c2025f324 (diff) |
Improvements in the shutdown procedure (NT service does not crash on exit anymore, give two seconds to threads to exit properly).
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@44 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio/ThreadSafeQueue.h')
-rw-r--r-- | orkaudio/ThreadSafeQueue.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/orkaudio/ThreadSafeQueue.h b/orkaudio/ThreadSafeQueue.h index 4fcc330..e050c85 100644 --- a/orkaudio/ThreadSafeQueue.h +++ b/orkaudio/ThreadSafeQueue.h @@ -61,13 +61,17 @@ template <class T> bool ThreadSafeQueue<T>::push(T &element) /** Pop and element from the queue, or blocks until one available */ template <class T> T ThreadSafeQueue<T>::pop() { - m_semaphore.acquire(); - + ACE_Time_Value timeout(time(NULL)+2); + m_semaphore.acquire(&timeout); MutexSentinel mutexSentinel(m_mutex); - T element = m_queue.front(); - m_queue.pop(); + T element; + if(m_queue.size() > 0) + { + element = m_queue.front(); + m_queue.pop(); + } return element; } |