aboutsummaryrefslogtreecommitdiff
path: root/src/stable
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/stable/synchroqueue.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/stable/synchroqueue.h b/src/stable/synchroqueue.h
index 7ba299f..1c16e15 100644
--- a/src/stable/synchroqueue.h
+++ b/src/stable/synchroqueue.h
@@ -124,23 +124,25 @@ namespace Bu
124 { 124 {
125 if( bBlock ) 125 if( bBlock )
126 { 126 {
127 for(;;) 127 cBlock.wait();
128
129 if( pStart == NULL )
128 { 130 {
129 if( pStart != NULL ) 131 cBlock.unlock();
130 { 132 return NULL;
131 cBlock.unlock();
132 break;
133 }
134 cBlock.wait();
135 } 133 }
136 134 T pTmp = pStart->pData;
137 T tmp = dequeue( false ); 135 Item *pDel = pStart;
136 pStart = pStart->pNext;
137 delete pDel;
138 nSize--;
138 139
139 cBlock.unlock(); 140 cBlock.unlock();
140 return tmp; 141 return pTmp;
141 142
142 } 143 }
143 144
145 cBlock.unlock();
144 return NULL; 146 return NULL;
145 } 147 }
146 else 148 else
@@ -226,6 +228,13 @@ namespace Bu
226 return nRet; 228 return nRet;
227 } 229 }
228 230
231 void unblockAll()
232 {
233 cBlock.lock();
234 cBlock.broadcast();
235 cBlock.unlock();
236 }
237
229 private: 238 private:
230 Item *pStart; /**< The start of the queue, the next element to dequeue. */ 239 Item *pStart; /**< The start of the queue, the next element to dequeue. */
231 Item *pEnd; /**< The end of the queue, the last element to dequeue. */ 240 Item *pEnd; /**< The end of the queue, the last element to dequeue. */