Notifies each component of a pause of the tick loop. Returns 0 if at least one of the components rejected the pause, otherwise 1.
| 1263 | // Notifies each component of a pause of the tick loop. |
| 1264 | // Returns 0 if at least one of the components rejected the pause, otherwise 1. |
| 1265 | int cComponentManager::pausedNotifyComponents(int threadId, int isPause) |
| 1266 | { |
| 1267 | if (!ready) return 0; |
| 1268 | int ret = 1; |
| 1269 | int i; |
| 1270 | for (i=0; i<=lastComponent; i++) { |
| 1271 | if (component[i] != NULL) { |
| 1272 | if (((threadId == -1)||(threadId == componentThreadId[i]))&&(componentThreadId[i]!=-2)) { |
| 1273 | if (isPause) { |
| 1274 | SMILE_DBG(4,"~~~~> pausing component '%s' (idx %i)",component[i]->getInstName(),i); |
| 1275 | if (!component[i]->pause()) { |
| 1276 | SMILE_ERR(2," component '%s' rejected pause.", component[i]->getInstName()); |
| 1277 | ret = 0; |
| 1278 | } |
| 1279 | } else { |
| 1280 | SMILE_DBG(4,"~~~~> resuming component '%s' (idx %i)",component[i]->getInstName(),i); |
| 1281 | component[i]->resume(); |
| 1282 | } |
| 1283 | } |
| 1284 | } |
| 1285 | } |
| 1286 | if (ret == 0) { |
| 1287 | SMILE_ERR(2,"Failed to pause tick loop."); |
| 1288 | } |
| 1289 | return ret; |
| 1290 | } |
| 1291 | |
| 1292 | /* pause tick loop: |
| 1293 | how=1 : notify components, halt loop in a sleep |
nothing calls this directly
no test coverage detected