| 29 | //----------------------------------------------------------------------------- |
| 30 | |
| 31 | void AsyncUpdateList::process( S32 timeOut ) |
| 32 | { |
| 33 | U32 endTime = 0; |
| 34 | if( timeOut != -1 ) |
| 35 | endTime = Platform::getRealMilliseconds() + timeOut; |
| 36 | |
| 37 | // Flush the process list. |
| 38 | |
| 39 | IPolled* ptr; |
| 40 | IPolled* firstProcessedPtr = 0; |
| 41 | |
| 42 | while( mUpdateList.tryPopFront( ptr ) ) |
| 43 | { |
| 44 | if( ptr == firstProcessedPtr ) |
| 45 | { |
| 46 | // We've wrapped around. Stop. |
| 47 | |
| 48 | mUpdateList.pushFront( ptr ); |
| 49 | break; |
| 50 | } |
| 51 | |
| 52 | if( ptr->update() ) |
| 53 | { |
| 54 | mUpdateList.pushBack( ptr ); |
| 55 | |
| 56 | if( !firstProcessedPtr ) |
| 57 | firstProcessedPtr = ptr; |
| 58 | } |
| 59 | |
| 60 | // Stop if we have exceeded our processing time budget. |
| 61 | |
| 62 | if( timeOut != -1 |
| 63 | && Platform::getRealMilliseconds() >= endTime ) |
| 64 | break; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | //-------------------------------------------------------------------------- |
| 69 | // AsyncUpdateThread implementation. |
no test coverage detected