| 411 | //-------------------------------------------------------------------------- |
| 412 | |
| 413 | void ThreadPool::flushWorkItems( S32 timeOut ) |
| 414 | { |
| 415 | AssertFatal( mNumThreads, "ThreadPool::flushWorkItems() - no worker threads in pool" ); |
| 416 | |
| 417 | U32 endTime = 0; |
| 418 | if( timeOut != -1 ) |
| 419 | endTime = Platform::getRealMilliseconds() + timeOut; |
| 420 | |
| 421 | // Spinlock until the queue is empty. |
| 422 | |
| 423 | while( !mWorkItemQueue.isEmpty() ) |
| 424 | { |
| 425 | Platform::sleep( 25 ); |
| 426 | |
| 427 | // Stop if we have exceeded our processing time budget. |
| 428 | |
| 429 | if( timeOut != -1 |
| 430 | && Platform::getRealMilliseconds() >= endTime ) |
| 431 | break; |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | void ThreadPool::waitForAllItems( S32 timeOut ) |
| 436 | { |
no test coverage detected