| 1296 | |
| 1297 | |
| 1298 | void EventManager::watcher_thread() |
| 1299 | { |
| 1300 | /************************************** |
| 1301 | * |
| 1302 | * w a t c h e r _ t h r e a d |
| 1303 | * |
| 1304 | ************************************** |
| 1305 | * |
| 1306 | * Functional description |
| 1307 | * Wait for something to happen. |
| 1308 | * |
| 1309 | **************************************/ |
| 1310 | bool startup = true; |
| 1311 | |
| 1312 | try |
| 1313 | { |
| 1314 | while (!m_exiting) |
| 1315 | { |
| 1316 | acquire_shmem(); |
| 1317 | |
| 1318 | prb* process = (prb*) SRQ_ABS_PTR(m_processOffset); |
| 1319 | process->prb_flags &= ~PRB_wakeup; |
| 1320 | |
| 1321 | const SLONG value = m_sharedMemory->eventClear(&process->prb_event); |
| 1322 | |
| 1323 | if (process->prb_flags & PRB_pending) |
| 1324 | { |
| 1325 | deliver(); |
| 1326 | } |
| 1327 | |
| 1328 | release_shmem(); |
| 1329 | |
| 1330 | if (startup) |
| 1331 | { |
| 1332 | startup = false; |
| 1333 | m_startupSemaphore.release(); |
| 1334 | } |
| 1335 | |
| 1336 | if (m_exiting) |
| 1337 | break; |
| 1338 | |
| 1339 | (void) m_sharedMemory->eventWait(&m_process->prb_event, value, 0); |
| 1340 | } |
| 1341 | } |
| 1342 | catch (const Exception& ex) |
| 1343 | { |
| 1344 | iscLogException("Error in event watcher thread\n", ex); |
| 1345 | } |
| 1346 | |
| 1347 | try |
| 1348 | { |
| 1349 | if (startup) |
| 1350 | { |
| 1351 | m_startupSemaphore.release(); |
| 1352 | } |
| 1353 | } |
| 1354 | catch (const Exception& ex) |
| 1355 | { |
nothing calls this directly
no test coverage detected