ensure that indexing threads operations are transparent to high level callers such as the real time monitor

This commit is contained in:
Jean-Francois Dockes
2012-11-26 15:40:31 +01:00
parent 6457fb4100
commit f252050247
5 changed files with 76 additions and 67 deletions
+3 -1
View File
@@ -107,8 +107,10 @@ public:
*/
bool put(T t)
{
if (!ok() || pthread_mutex_lock(&m_mutex) != 0)
if (!ok() || pthread_mutex_lock(&m_mutex) != 0) {
LOGERR(("WorkQueue::put: !ok or mutex_lock failed\n"));
return false;
}
while (ok() && m_high > 0 && m_queue.size() >= m_high) {
// Keep the order: we test ok() AFTER the sleep...