| 1659 | } |
| 1660 | |
| 1661 | void cComponentManager::controlLoopA() |
| 1662 | { |
| 1663 | int run = 1; |
| 1664 | |
| 1665 | smileMutexLock(syncCondMtx); |
| 1666 | endOfLoop=0; |
| 1667 | |
| 1668 | smileMutexLock(waitEndMtx); |
| 1669 | waitEndCnt=0; |
| 1670 | controllerPresent=1; |
| 1671 | smileCondBroadcast(waitControllerCond); |
| 1672 | smileMutexUnlock(waitEndMtx); |
| 1673 | |
| 1674 | do { |
| 1675 | if (!abortRequest) smileCondWaitWMtx(controlCond,syncCondMtx); |
| 1676 | // if control cond was signald, all thread are waiting...! |
| 1677 | // set a flag, an thus execute each thread loop excatly ONCE! |
| 1678 | // then check the status, if still all are waiting, exit, else continue! |
| 1679 | if (probeFlag) { |
| 1680 | // fprintf(stderr,"probe end cr=%i nP %i nA %i\n",compRunFlag,nProbe,nActive);fflush(stderr); |
| 1681 | if (compRunFlag == 0) { |
| 1682 | // final exit! |
| 1683 | run = 0; |
| 1684 | } else { |
| 1685 | // continue |
| 1686 | nProbe = 0; |
| 1687 | nWaiting = 0; |
| 1688 | probeFlag = 0; |
| 1689 | //cnt = 0; |
| 1690 | } |
| 1691 | } else { |
| 1692 | // probe components.. |
| 1693 | // fprintf(stderr,"probe start nW %i\n",nWaiting); fflush(stderr); |
| 1694 | nWaiting = 0; |
| 1695 | compRunFlag = 0; |
| 1696 | probeFlag = 1; |
| 1697 | nProbe = 0; |
| 1698 | } |
| 1699 | |
| 1700 | smileMutexLock(abortMtx); |
| 1701 | if (abortRequest) { run = 0; } |
| 1702 | else if (run==0) { endOfLoop = 1; } |
| 1703 | smileMutexUnlock(abortMtx); |
| 1704 | // fprintf(stderr,"cr stat nW %i nP %i ab %i run %i pf %i\n",nWaiting,nProbe,abortRequest,run,probeFlag); fflush(stderr); |
| 1705 | |
| 1706 | smileCondBroadcast(syncCond); |
| 1707 | |
| 1708 | } while(run); |
| 1709 | smileMutexUnlock(syncCondMtx); |
| 1710 | |
| 1711 | compRunFlag = 0; probeFlag = 0; nProbe = 0; nWaiting = 0; |
| 1712 | } |
| 1713 | |
| 1714 | |
| 1715 | long long cComponentManager::tickLoopA(long long maxtick, int threadId, sThreadData *_data) |
no test coverage detected