|
From: Hans D. <dul...@us...> - 2000-11-13 20:15:39
|
Update of /cvsroot/corelinux/corelinux/src/classlibs/corelinux In directory slayer.i.sourceforge.net:/tmp/cvs-serv8301 Modified Files: SemaphoreCommon.cpp Log Message: Replaced OFF and ON symbolic value with 0 and 1. Index: SemaphoreCommon.cpp =================================================================== RCS file: /cvsroot/corelinux/corelinux/src/classlibs/corelinux/SemaphoreCommon.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** SemaphoreCommon.cpp 2000/09/09 07:18:33 1.9 --- SemaphoreCommon.cpp 2000/11/13 20:15:36 1.10 *************** *** 139,147 **** // ! if( theBase->creatorId == OFF ) { theBase->creatorId = (Int)aId; ! theBase->currentUsed = OFF; ! theBase->currentGrps = OFF; theOriginator = true; --- 139,147 ---- // ! if( theBase->creatorId == 0 ) { theBase->creatorId = (Int)aId; ! theBase->currentUsed = 0; ! theBase->currentGrps = 0; theOriginator = true; *************** *** 163,167 **** // First entry information ! theBase->currentGrps = ON; aGrpPtr->groupSemCount = theBase->currentUsed = --- 163,167 ---- // First entry information ! theBase->currentGrps = 1; aGrpPtr->groupSemCount = theBase->currentUsed = *************** *** 169,173 **** aGrpPtr->groupInfo = aGid; ! aGrpPtr->groupShares = ON; // Setup the control semaphore --- 169,173 ---- aGrpPtr->groupInfo = aGid; ! aGrpPtr->groupShares = 1; // Setup the control semaphore *************** *** 175,183 **** GETCNTLSEM(aSemPtr,aGrpPtr,aGrpPtr->groupSemCount); ! aSemPtr->maxSemValue = -ON; aSemPtr->isRecursive = OFF; aSemPtr->isBalking = OFF; ! aSemPtr->semShares = ON; ! semctl( aGid, aGrpPtr->groupSemCount-1, SETVAL, ON ); } --- 175,183 ---- GETCNTLSEM(aSemPtr,aGrpPtr,aGrpPtr->groupSemCount); ! aSemPtr->maxSemValue = -1; aSemPtr->isRecursive = OFF; aSemPtr->isBalking = OFF; ! aSemPtr->semShares = 1; ! semctl( aGid, aGrpPtr->groupSemCount-1, SETVAL, 1 ); } *************** *** 194,200 **** theControlGroup = new MutexSemaphoreGroup ( ! OFF, myTokenizer, ! OFF, FAIL_IF_NOTEXISTS ); --- 194,200 ---- theControlGroup = new MutexSemaphoreGroup ( ! 0, myTokenizer, ! 0, FAIL_IF_NOTEXISTS ); *************** *** 204,209 **** // Increment the shares on the control group and control semaphore ! aGrpPtr->groupShares += ON; ! aSemPtr->semShares += ON; } --- 204,209 ---- // Increment the shares on the control group and control semaphore ! aGrpPtr->groupShares += 1; ! aSemPtr->semShares += 1; } *************** *** 245,249 **** CSAGrpHeaderPtr aGrpPtr( (CSAGrpHeaderPtr)theBase ); ++aGrpPtr; ! aGrpPtr->groupShares -= ON; return aGrpPtr->groupShares; } --- 245,249 ---- CSAGrpHeaderPtr aGrpPtr( (CSAGrpHeaderPtr)theBase ); ++aGrpPtr; ! aGrpPtr->groupShares -= 1; return aGrpPtr->groupShares; } *************** *** 285,293 **** // ! if( theBase->currentUsed == OFF ) { ! theBase->currentGrps = ON; aGrpPtr->groupSemCount = theBase->currentUsed = aSemCnt; ! aGrpPtr->groupShares = ON; aGrpPtr->groupInfo = anId; } --- 285,293 ---- // ! if( theBase->currentUsed == 0 ) { ! theBase->currentGrps = 1; aGrpPtr->groupSemCount = theBase->currentUsed = aSemCnt; ! aGrpPtr->groupShares = 1; aGrpPtr->groupInfo = anId; } *************** *** 364,368 **** // ! if( aGrpPtr->groupInfo == OFF ) { // --- 364,368 ---- // ! if( aGrpPtr->groupInfo == 0 ) { // *************** *** 371,375 **** // ! theBase->currentGrps += ON; theBase->currentUsed += aSemCnt; aGrpPtr->groupSemCount = aSemCnt; --- 371,375 ---- // ! theBase->currentGrps += 1; theBase->currentUsed += aSemCnt; aGrpPtr->groupSemCount = aSemCnt; *************** *** 381,388 **** } ! aGroupSem->maxSemValue = -ON; aGroupSem->isRecursive = OFF; aGroupSem->isBalking = OFF; ! semctl( anId, aSemCnt-1, SETVAL, ON ); aGrpPtr->groupInfo = anId; --- 381,388 ---- } ! aGroupSem->maxSemValue = -1; aGroupSem->isRecursive = OFF; aGroupSem->isBalking = OFF; ! semctl( anId, aSemCnt-1, SETVAL, 1 ); aGrpPtr->groupInfo = anId; *************** *** 397,402 **** // ! aGroupSem->semShares += ON; ! aGrpPtr->groupShares += ON; } --- 397,402 ---- // ! aGroupSem->semShares += 1; ! aGrpPtr->groupShares += 1; } *************** *** 436,443 **** // ! if( aGrpPtr->groupShares == ON ) { CSAGrpHeaderPtr aNextGrpPtr( aGrpPtr ); ! aNextGrpPtr += aGrpPtr->groupSemCount + ON; UNLOCKSEM(aGrpPtr->groupInfo,aGrpPtr->groupSemCount,aGroupSem); --- 436,443 ---- // ! if( aGrpPtr->groupShares == 1 ) { CSAGrpHeaderPtr aNextGrpPtr( aGrpPtr ); ! aNextGrpPtr += aGrpPtr->groupSemCount + 1; UNLOCKSEM(aGrpPtr->groupInfo,aGrpPtr->groupSemCount,aGroupSem); *************** *** 445,460 **** // If we are the tail, get rid of us ! if( aNextGrpPtr->groupInfo == OFF ) { theBase->currentUsed -= aGrpPtr->groupSemCount; ! theBase->currentGrps -= ON; ! aGrpPtr->groupInfo = OFF; } else { ! aGrpPtr->groupInfo = -ON; ! aGrpPtr->groupShares = OFF; ! aGrpPtr->groupType = -ON; ! aGroupSem->semShares = OFF; } } --- 445,460 ---- // If we are the tail, get rid of us ! if( aNextGrpPtr->groupInfo == 0 ) { theBase->currentUsed -= aGrpPtr->groupSemCount; ! theBase->currentGrps -= 1; ! aGrpPtr->groupInfo = 0; } else { ! aGrpPtr->groupInfo = -1; ! aGrpPtr->groupShares = 0; ! aGrpPtr->groupType = -1; ! aGroupSem->semShares = 0; } } *************** *** 463,468 **** else { ! aGrpPtr->groupShares -= ON; ! aGroupSem->semShares -= ON; results = aGrpPtr->groupShares; UNLOCKSEM(aGrpPtr->groupInfo,aGrpPtr->groupSemCount,aGroupSem); --- 463,468 ---- else { ! aGrpPtr->groupShares -= 1; ! aGroupSem->semShares -= 1; results = aGrpPtr->groupShares; UNLOCKSEM(aGrpPtr->groupInfo,aGrpPtr->groupSemCount,aGroupSem); *************** *** 517,525 **** if( aSemIndex < realCnt ) { ! GETCNTLSEM(aCandidateSem,aGrpPtr,aSemIndex+ON); // If the candidate is available ! if( aCandidateSem->semShares == OFF ) { // If it should have been in existence --- 517,525 ---- if( aSemIndex < realCnt ) { ! GETCNTLSEM(aCandidateSem,aGrpPtr,aSemIndex+1); // If the candidate is available ! if( aCandidateSem->semShares == 0 ) { // If it should have been in existence *************** *** 534,538 **** else { ! aCandidateSem->semShares = ON; aCandidateSem->maxSemValue = aMaxValue; aCandidateSem->isRecursive = aRecurse; --- 534,538 ---- else { ! aCandidateSem->semShares = 1; aCandidateSem->maxSemValue = aMaxValue; aCandidateSem->isRecursive = aRecurse; *************** *** 550,554 **** else { ! aCandidateSem->semShares += ON; aRecurse = aCandidateSem->isRecursive; aBalking = aCandidateSem->isBalking; --- 550,554 ---- else { ! aCandidateSem->semShares += 1; aRecurse = aCandidateSem->isRecursive; aBalking = aCandidateSem->isBalking; *************** *** 574,583 **** for( Int x=0; x < realCnt; ++x ) { ! GETCNTLSEM(aCandidateSem,aGrpPtr,x+ON); ! if( aCandidateSem->semShares == OFF ) { results = x; ! aCandidateSem->semShares = ON; aCandidateSem->maxSemValue = aMaxValue; aCandidateSem->isRecursive = aRecurse; --- 574,583 ---- for( Int x=0; x < realCnt; ++x ) { ! GETCNTLSEM(aCandidateSem,aGrpPtr,x+1); ! if( aCandidateSem->semShares == 0 ) { results = x; ! aCandidateSem->semShares = 1; aCandidateSem->maxSemValue = aMaxValue; aCandidateSem->isRecursive = aRecurse; *************** *** 615,619 **** LOCKSEM(aGrpPtr->groupInfo,aGrpPtr->groupSemCount,aGroupSem); ! Int results(OFF); Int realCnt(aGrpPtr->groupSemCount-1); --- 615,619 ---- LOCKSEM(aGrpPtr->groupInfo,aGrpPtr->groupSemCount,aGroupSem); ! Int results(0); Int realCnt(aGrpPtr->groupSemCount-1); *************** *** 621,632 **** { CSASemHeaderPtr aCandidateSem( NULLPTR ); ! GETCNTLSEM(aCandidateSem,aGrpPtr,aSemIndex+ON); ! if( aCandidateSem->semShares > OFF ) { ! aCandidateSem->semShares -= ON; results = aCandidateSem->semShares; if( results == 0 ) { ! aCandidateSem->maxSemValue = OFF; aCandidateSem->isRecursive = OFF; aCandidateSem->isBalking = OFF; --- 621,632 ---- { CSASemHeaderPtr aCandidateSem( NULLPTR ); ! GETCNTLSEM(aCandidateSem,aGrpPtr,aSemIndex+1); ! if( aCandidateSem->semShares > 0 ) { ! aCandidateSem->semShares -= 1; results = aCandidateSem->semShares; if( results == 0 ) { ! aCandidateSem->maxSemValue = 0; aCandidateSem->isRecursive = OFF; aCandidateSem->isBalking = OFF; *************** *** 672,676 **** else { ! aHead += (aHead->groupSemCount+ON); } } --- 672,676 ---- else { ! aHead += (aHead->groupSemCount+1); } } *************** *** 699,707 **** else { ! aHead += (aHead->groupSemCount+ON); } } ! if( aGrpPtr == NULLPTR && aHead->groupInfo == OFF ) { Int testVal --- 699,707 ---- else { ! aHead += (aHead->groupSemCount+1); } } ! if( aGrpPtr == NULLPTR && aHead->groupInfo == 0 ) { Int testVal *************** *** 710,714 **** theBase->currentUsed + theBase->currentGrps + ! ON ); --- 710,714 ---- theBase->currentUsed + theBase->currentGrps + ! 1 ); *************** *** 747,751 **** for( Int x = 0; x < aMax && aGrp == NULLPTR; ++x ) { ! if( aCntrlGroup->groupInfo == -ON ) { if( aCntrlGroup->groupSemCount > aCountNeeded ) --- 747,751 ---- for( Int x = 0; x < aMax && aGrp == NULLPTR; ++x ) { ! if( aCntrlGroup->groupInfo == -1 ) { if( aCntrlGroup->groupSemCount > aCountNeeded ) *************** *** 754,764 **** aGrp = aCntrlGroup; ! aCntrlGroup += aCountNeeded+ON; // Set new group marker ! aCntrlGroup->groupInfo = -ON; aCntrlGroup->groupSemCount = ! (aGrp->groupSemCount - (aCountNeeded+ON)); aGrp->groupSemCount = aCountNeeded; --- 754,764 ---- aGrp = aCntrlGroup; ! aCntrlGroup += aCountNeeded+1; // Set new group marker ! aCntrlGroup->groupInfo = -1; aCntrlGroup->groupSemCount = ! (aGrp->groupSemCount - (aCountNeeded+1)); aGrp->groupSemCount = aCountNeeded; *************** *** 768,773 **** // increased the group count ! theBase->currentUsed -= ON; ! theBase->currentGrps += ON; } else --- 768,773 ---- // increased the group count ! theBase->currentUsed -= 1; ! theBase->currentGrps += 1; } else *************** *** 781,785 **** } ! aCntrlGroup += aCntrlGroup->groupSemCount+ON; } --- 781,785 ---- } ! aCntrlGroup += aCntrlGroup->groupSemCount+1; } *************** *** 803,807 **** for( Int x = 0; x < aMax; ) { ! if( aCntrlGroup->groupInfo == -ON ) { // If we have not begun --- 803,807 ---- for( Int x = 0; x < aMax; ) { ! if( aCntrlGroup->groupInfo == -1 ) { // If we have not begun *************** *** 818,831 **** { aGrpBegin->groupSemCount += ! (aCntrlGroup->groupSemCount + ON); // Emulate a dead semaphore aCntrlGroup->groupInfo = ! aCntrlGroup->groupShares = aCntrlGroup->groupSemCount = OFF; --aMax; ! theBase->currentGrps -= ON; ! theBase->currentUsed += ON; aCntrlGroup = aGrpBegin; } --- 818,831 ---- { aGrpBegin->groupSemCount += ! (aCntrlGroup->groupSemCount + 1); // Emulate a dead semaphore aCntrlGroup->groupInfo = ! aCntrlGroup->groupShares = aCntrlGroup->groupSemCount = 0; --aMax; ! theBase->currentGrps -= 1; ! theBase->currentUsed += 1; aCntrlGroup = aGrpBegin; } *************** *** 836,840 **** ++x; } ! aCntrlGroup += aCntrlGroup->groupSemCount+ON; } --- 836,840 ---- ++x; } ! aCntrlGroup += aCntrlGroup->groupSemCount+1; } *************** *** 912,921 **** REQUIRE( aGroup != NULLPTR ); ! Int results(OFF); ! struct sembuf aSemBuf={ aSid, -ON, aFlg}; if( aGroup->isPrivate() == true ) { ! results = semop( aGid, &aSemBuf, ON ); } else --- 912,921 ---- REQUIRE( aGroup != NULLPTR ); ! Int results(0); ! struct sembuf aSemBuf={ aSid, -1, aFlg}; if( aGroup->isPrivate() == true ) { ! results = semop( aGid, &aSemBuf, 1 ); } else *************** *** 924,930 **** CSASemHeaderPtr aGroupSem( NULLPTR ); ! GETCNTLSEM(aGroupSem,aGrpPtr,aSid+ON); ! results = semop( aGid, &aSemBuf, ON ); aGroupSem->semOwner = --- 924,930 ---- CSASemHeaderPtr aGroupSem( NULLPTR ); ! GETCNTLSEM(aGroupSem,aGrpPtr,aSid+1); ! results = semop( aGid, &aSemBuf, 1 ); aGroupSem->semOwner = *************** *** 951,959 **** Int results(0); ! struct sembuf aSemBuf={ aSid, ON, aFlg}; if( aGroup->isPrivate() == true ) { ! results = semop( aGid, &aSemBuf, ON ); } else --- 951,959 ---- Int results(0); ! struct sembuf aSemBuf={ aSid, 1, aFlg}; if( aGroup->isPrivate() == true ) { ! results = semop( aGid, &aSemBuf, 1 ); } else *************** *** 962,971 **** CSASemHeaderPtr aGroupSem( NULLPTR ); ! GETCNTLSEM(aGroupSem,aGrpPtr,aSid+ON); ! results = semop( aGid, &aSemBuf, ON ); aGroupSem->semOwner = ! (!results ? (Int) OFF : aGroupSem->semOwner); } return results; --- 962,971 ---- CSASemHeaderPtr aGroupSem( NULLPTR ); ! GETCNTLSEM(aGroupSem,aGrpPtr,aSid+1); ! results = semop( aGid, &aSemBuf, 1 ); aGroupSem->semOwner = ! (!results ? (Int) 0 : aGroupSem->semOwner); } return results; *************** *** 991,995 **** if( aGroup->isPrivate() == true ) { ! results = semop( aGid, &aSemBuf, ON ); } else --- 991,995 ---- if( aGroup->isPrivate() == true ) { ! results = semop( aGid, &aSemBuf, 1 ); } else *************** *** 998,1007 **** CSASemHeaderPtr aGroupSem( NULLPTR ); ! GETCNTLSEM(aGroupSem,aGrpPtr,aSid+ON); ! results = semop( aGid, &aSemBuf, ON ); aGroupSem->semOwner = ! (!results ? (Int) OFF : aGroupSem->semOwner); } return results; --- 998,1007 ---- CSASemHeaderPtr aGroupSem( NULLPTR ); ! GETCNTLSEM(aGroupSem,aGrpPtr,aSid+1); ! results = semop( aGid, &aSemBuf, 1 ); aGroupSem->semOwner = ! (!results ? (Int) 0 : aGroupSem->semOwner); } return results; *************** *** 1025,1033 **** REQUIRE( aGroup != NULLPTR ); ! Int results(OFF); if( aGroup->isPrivate() == true ) { ! results = -ON; } else --- 1025,1033 ---- REQUIRE( aGroup != NULLPTR ); ! Int results(0); if( aGroup->isPrivate() == true ) { ! results = -1; } else *************** *** 1057,1061 **** ) { ! Int results(OFF); if( aGroup->isPrivate() == true ) { --- 1057,1061 ---- ) { ! Int results(0); if( aGroup->isPrivate() == true ) { *************** *** 1118,1122 **** CSASemHeaderPtr aGroupSem( NULLPTR ); ! GETCNTLSEM(aGroupSem,aGrpPtr,aSemId+ON); results = aGroupSem->maxSemValue; --- 1118,1122 ---- CSASemHeaderPtr aGroupSem( NULLPTR ); ! GETCNTLSEM(aGroupSem,aGrpPtr,aSemId+1); results = aGroupSem->maxSemValue; |