| … | … | @@ -377,10 +377,11 @@ void async_buffer<Writer, Element>::drain() |
| 377 | 377 | _flush_count++; |
| 378 | 378 | |
| 379 | 379 | // Wait for all pending work to complete |
| 380 | while (0 < _pending) | |
| 380 | unsigned long pend = _pending.load(); | |
| 381 | while (pend != 0) | |
| 381 | 382 | { |
| 382 | unsigned long pend = _pending.load(); | |
| 383 | if (pend > 0) _pending.wait(pend); | |
| 383 | _pending.wait(pend); | |
| 384 | pend = _pending.load(); | |
| 384 | 385 | } |
| 385 | 386 | |
| 386 | 387 | _stall_writers = save_stall; |
| … | … | @@ -295,10 +295,11 @@ void async_caller<Writer, Element>::drain() |
| 295 | 295 | _flush_count++; |
| 296 | 296 | |
| 297 | 297 | // Wait for all pending work to complete |
| 298 | while (0 < _pending) | |
| 298 | unsigned long pend = _pending.load(); | |
| 299 | while (pend != 0) | |
| 299 | 300 | { |
| 300 | unsigned long pend = _pending.load(); | |
| 301 | if (pend > 0) _pending.wait(pend); | |
| 301 | _pending.wait(pend); | |
| 302 | pend = _pending.load(); | |
| 302 | 303 | } |
| 303 | 304 | } |
| 304 | 305 |