pause tick loop: how=1 : notify components, halt loop in a sleep how=2 : notify components, wait for nRun = 0 (force NOT EOI!), then put loop to sleep timeout : if how=2, then max number of ticks of nRun>0 , after which pause request is discarded and EOI is assumed again when nRun=0 (irrelevant when how=1) */
| 1295 | timeout : if how=2, then max number of ticks of nRun>0 , after which pause request is discarded and EOI is assumed again when nRun=0 (irrelevant when how=1) |
| 1296 | */ |
| 1297 | void cComponentManager::pause(int how, int timeout) |
| 1298 | { |
| 1299 | // WARNING: pause/resume is currently only implemented for single thread processing! |
| 1300 | smileMutexLock(pauseMtx); |
| 1301 | if (tickLoopPaused && how > 0) { |
| 1302 | smileMutexUnlock(pauseMtx); |
| 1303 | return; |
| 1304 | } |
| 1305 | int oldTickLoopPaused = tickLoopPaused; |
| 1306 | tickLoopPaused = how; |
| 1307 | tickLoopPauseTimeout = timeout; |
| 1308 | pauseStartNr = -1; |
| 1309 | if (how == 0 && oldTickLoopPaused) { |
| 1310 | //smileCondBroadcast(pauseCond); // for multi-threaded tick loops ? |
| 1311 | smileCondSignal(pauseCond); |
| 1312 | } |
| 1313 | smileMutexUnlock(pauseMtx); |
| 1314 | } |
| 1315 | |
| 1316 | // If the tickLoopPaused flag is set, notifies all components of the imminent pause, |
| 1317 | // blocks until the tick loop is resumed, and notifies components of the resume. |
no test coverage detected