| 433 | } |
| 434 | |
| 435 | void ThreadPool::waitForAllItems( S32 timeOut ) |
| 436 | { |
| 437 | U32 endTime = 0; |
| 438 | if( timeOut != -1 ) |
| 439 | endTime = Platform::getRealMilliseconds() + timeOut; |
| 440 | |
| 441 | // Spinlock until there are no items that have not been processed. |
| 442 | |
| 443 | while( dAtomicRead( mNumPendingItems ) ) |
| 444 | { |
| 445 | Platform::sleep( 25 ); |
| 446 | |
| 447 | // Stop if we have exceeded our processing time budget. |
| 448 | |
| 449 | if( timeOut != -1 |
| 450 | && Platform::getRealMilliseconds() >= endTime ) |
| 451 | break; |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | //-------------------------------------------------------------------------- |
| 456 | |