#include <SemaphoreCommon.hpp>

Static Public Member Functions | |
| static Int | getSemaphoreMaxValue (SemaphoreGroupPtr, Int) |
| Returns the maximum value for a semaphore as defined by the original semaphore claimant. | |
| static void | groupDefined (SemaphoreGroupPtr) |
| When a shared semaphore group is created, it is updated in the CSA, either by increasing the count of processes accessing a particular group, or adding to the csa initially. | |
| static Int | groupUnDefined (SemaphoreGroupPtr) |
| When the local process is deleting a semaphore group and it is considered a shared group, we are asked to adjust the map accordingly. | |
| static Int | setLock (SemaphoreGroupPtr, Int, Int, Int) |
| Called by the base semaphore to aquire a lock for a specific semaphore. | |
| static Int | setUnLock (SemaphoreGroupPtr, Int, Int, Int) |
| Called by the base semaphore to relinquish a lock for a specific semaphore. | |
| static Int | waitZero (SemaphoreGroupPtr, Int, Int, Int) |
| Called by the base semaphore to wait for a specific semaphore to have a zero value. | |
| static Int | obtainSemaphore (SemaphoreGroupPtr, Int, IntRef, IntRef, IntRef, Int) |
| Typically called by a SemaphoreGroup prior to passing out the semaphore type to the caller. | |
| static Int | relinquishSemaphore (SemaphoreGroupPtr, Int) |
| Called when the semaphore is no longer being referenced. | |
| static Int | setMaxValue (SemaphoreGroupPtr, Int, Int) |
| Called to set the semaphore maximum value. | |
Protected Member Functions | |
| SemaphoreCommon (void) | |
| Default constructor used by class. | |
| virtual | ~SemaphoreCommon (void) |
| Destructor. | |
| void | registerGroup (SemaphoreGroupPtr) |
| Does the work of getting the group registered in the CSA. | |
| Int | deregisterGroup (SemaphoreGroupPtr) |
| Does the work of reducing the group share count, or marking the group for reclaimation. | |
| Int | claimSemaphore (SemaphoreGroupPtr, Int, IntRef, IntRef, IntRef, Int) |
| Called when the group is determined to be shared and a semaphore share is to be claimed. | |
| Int | reclaimSemaphore (SemaphoreGroupPtr, Int) |
| Called when a group wishes to let the CSA reclaim a semaphore share. | |
| CSAGrpHeaderPtr | findGroup (IntCref, IntCref, CSAGrpHeaderPtr) |
| Attempt to locate a specific group. | |
| CSAGrpHeaderPtr | findAvailableGroup (IntCref, IntCref, CSAGrpHeaderPtr) |
| Find open slot that fits count criteria. | |
| CSAGrpHeaderPtr | subsetGroup (Int, CSAGrpHeaderPtr) |
| Utility to clean CSA group tail. | |
| CSAGrpHeaderPtr | combineGroup (Int, CSAGrpHeaderPtr) |
| bool | isOriginator (void) const |
| Int | getOriginatorId (void) const |
| Int | canonicalUndefined (void) |
Static Protected Member Functions | |
| static void | createAttachment (void) |
| Factory for CSA. | |
| static void | exitAttachment (void) |
| On the way out from run-time. | |
Friends | |
| class | CoreLinuxGuardPool |
This area is to communicate between address spaces when using one of the CoreLinux++ SemaphoreGroup types in public mode.
| Int corelinux::SemaphoreCommon::getSemaphoreMaxValue | ( | SemaphoreGroupPtr | aGroup, | |
| Int | aSemId | |||
| ) | [static] |
Returns the maximum value for a semaphore as defined by the original semaphore claimant.
| SemaphoreGroup | pointer to group owner | |
| Int | zero offset semaphore identifier |
References corelinux::SemaphoreGroup::isPrivate(), corelinux::_CSASemaphoreHeader::maxSemValue, and corelinux::SemaphoreGroup::theGroupCSA.
Referenced by corelinux::AbstractSemaphore::getInitialValue().
| void corelinux::SemaphoreCommon::groupDefined | ( | SemaphoreGroupPtr | aGroup | ) | [static] |
When a shared semaphore group is created, it is updated in the CSA, either by increasing the count of processes accessing a particular group, or adding to the csa initially.
| SemaphoreGroup | pointer |
References createAttachment(), and registerGroup().
Referenced by corelinux::SemaphoreGroup::SemaphoreGroup().
| Int corelinux::SemaphoreCommon::groupUnDefined | ( | SemaphoreGroupPtr | aGroup | ) | [static] |
When the local process is deleting a semaphore group and it is considered a shared group, we are asked to adjust the map accordingly.
| SemaphoreGroup | pointer to the group |
References canonicalUndefined(), and deregisterGroup().
Referenced by corelinux::SemaphoreGroup::~SemaphoreGroup().
| Int corelinux::SemaphoreCommon::setLock | ( | SemaphoreGroupPtr | aGroup, | |
| Int | aGid, | |||
| Int | aSid, | |||
| Int | aFlg | |||
| ) | [static] |
Called by the base semaphore to aquire a lock for a specific semaphore.
| SemaphoreGroup | pointer to the group | |
| Int | the system group id | |
| Int | the zero offset semaphore id | |
| Int | the system dependent flag |
References corelinux::Thread::getThreadIdentifier(), corelinux::SemaphoreGroup::isPrivate(), corelinux::_CSASemaphoreHeader::semOwner, and corelinux::SemaphoreGroup::theGroupCSA.
Referenced by corelinux::AbstractSemaphore::setLock().
| Int corelinux::SemaphoreCommon::setUnLock | ( | SemaphoreGroupPtr | aGroup, | |
| Int | aGid, | |||
| Int | aSid, | |||
| Int | aFlg | |||
| ) | [static] |
Called by the base semaphore to relinquish a lock for a specific semaphore.
| SemaphoreGroup | pointer to the group | |
| Int | the system group id | |
| Int | the zero offset semaphore id | |
| Int | the system dependent flag |
References corelinux::SemaphoreGroup::isPrivate(), corelinux::_CSASemaphoreHeader::semOwner, and corelinux::SemaphoreGroup::theGroupCSA.
Referenced by corelinux::AbstractSemaphore::setUnlock().
| Int corelinux::SemaphoreCommon::waitZero | ( | SemaphoreGroupPtr | aGroup, | |
| Int | aGid, | |||
| Int | aSid, | |||
| Int | aFlg | |||
| ) | [static] |
Called by the base semaphore to wait for a specific semaphore to have a zero value.
| SemaphoreGroup | pointer to the group | |
| Int | the system group id | |
| Int | the zero offset semaphore id | |
| Int | the system dependent flag |
References corelinux::SemaphoreGroup::isPrivate(), corelinux::_CSASemaphoreHeader::semOwner, and corelinux::SemaphoreGroup::theGroupCSA.
Referenced by corelinux::AbstractSemaphore::waitZero().
| Int corelinux::SemaphoreCommon::obtainSemaphore | ( | SemaphoreGroupPtr | aGroup, | |
| Int | aSemIndex, | |||
| IntRef | aMaxValue, | |||
| IntRef | aRecurse, | |||
| IntRef | aBalking, | |||
| Int | aFailConstraint | |||
| ) | [static] |
Typically called by a SemaphoreGroup prior to passing out the semaphore type to the caller.
| SemaphoreGroup | the group pointer | |
| Int | the semaphore identifier/index -1 = any | |
| Int | reference the initial value (becomes the max if new) | |
| Int | reference the recursive condition | |
| Int | reference the balking condition | |
| Int | 0 must not exist, 1 share, 2 must exist |
References claimSemaphore(), and corelinux::SemaphoreGroup::isPrivate().
Referenced by corelinux::MutexSemaphoreGroup::resolveSemaphore(), and corelinux::GatewaySemaphoreGroup::resolveSemaphore().
| Int corelinux::SemaphoreCommon::relinquishSemaphore | ( | SemaphoreGroupPtr | aGroup, | |
| Int | aSemIndex | |||
| ) | [static] |
Called when the semaphore is no longer being referenced.
Effectively reducing the share count for shared group semaphores
| SemaphoreGroup | pointer | |
| Int | the zero index semaphore identifier |
References corelinux::SemaphoreGroup::isPrivate(), and reclaimSemaphore().
Referenced by corelinux::MutexSemaphoreGroup::destroySemaphore(), corelinux::GatewaySemaphoreGroup::destroySemaphore(), corelinux::EventSemaphoreGroup::destroySemaphore(), corelinux::EventSemaphoreGroup::~EventSemaphoreGroup(), corelinux::GatewaySemaphoreGroup::~GatewaySemaphoreGroup(), and corelinux::MutexSemaphoreGroup::~MutexSemaphoreGroup().
| Int corelinux::SemaphoreCommon::setMaxValue | ( | SemaphoreGroupPtr | aGroup, | |
| Int | aId, | |||
| Int | aValue | |||
| ) | [static] |
Called to set the semaphore maximum value.
For local this is SETVAL, for shared it is ignored
| SemaphoreGroup | pointer | |
| Int | the zero index semaphore identifier | |
| Int | the value |
References corelinux::SemaphoreGroup::isPrivate(), and corelinux::SemaphoreGroup::theIdentifier.
Referenced by corelinux::AbstractSemaphore::setValue().
| void corelinux::SemaphoreCommon::registerGroup | ( | SemaphoreGroupPtr | aGroup | ) | [protected] |
Does the work of getting the group registered in the CSA.
| SemaphoreGroup | pointer to register |
References findAvailableGroup(), findGroup(), corelinux::SemaphoreGroup::getIdentifier(), corelinux::_CSAGroupHeader::groupInfo, corelinux::_CSAGroupHeader::groupSemCount, corelinux::_CSAGroupHeader::groupShares, corelinux::_CSASemaphoreHeader::isBalking, corelinux::_CSASemaphoreHeader::isRecursive, corelinux::_CSASemaphoreHeader::maxSemValue, corelinux::_CSASemaphoreHeader::semShares, subsetGroup(), and corelinux::SemaphoreGroup::theGroupCSA.
Referenced by groupDefined().
| Int corelinux::SemaphoreCommon::deregisterGroup | ( | SemaphoreGroupPtr | aGroup | ) | [protected] |
Does the work of reducing the group share count, or marking the group for reclaimation.
| SemaphoreGroup | pointer to register |
References corelinux::_CSAHeader::currentGrps, corelinux::_CSAHeader::currentUsed, corelinux::_CSAGroupHeader::groupInfo, corelinux::_CSAGroupHeader::groupSemCount, corelinux::_CSAGroupHeader::groupShares, corelinux::_CSAGroupHeader::groupType, corelinux::_CSASemaphoreHeader::semShares, and corelinux::SemaphoreGroup::theGroupCSA.
Referenced by groupUnDefined().
| Int corelinux::SemaphoreCommon::claimSemaphore | ( | SemaphoreGroupPtr | aGroup, | |
| Int | aSemIndex, | |||
| IntRef | aMaxValue, | |||
| IntRef | aRecurse, | |||
| IntRef | aBalking, | |||
| Int | aFailConstraint | |||
| ) | [protected] |
Called when the group is determined to be shared and a semaphore share is to be claimed.
| SemaphoreGroup | the group pointer | |
| Int | the semaphore identifier/index -1 = any | |
| Int | the initial value (becomes the max if new) | |
| IntRef | the recursive condition | |
| IntRef | the balking condition | |
| Int | 0 must not exist, 1 share, 2 must exist |
References corelinux::_CSAGroupHeader::groupInfo, corelinux::_CSAGroupHeader::groupSemCount, corelinux::_CSASemaphoreHeader::isBalking, corelinux::_CSASemaphoreHeader::isRecursive, corelinux::_CSASemaphoreHeader::maxSemValue, corelinux::_CSASemaphoreHeader::semShares, corelinux::SemaphoreGroup::theGroupCSA, and corelinux::SemaphoreGroup::theIdentifier.
Referenced by obtainSemaphore().
| Int corelinux::SemaphoreCommon::reclaimSemaphore | ( | SemaphoreGroupPtr | aGroup, | |
| Int | aSemIndex | |||
| ) | [protected] |
Called when a group wishes to let the CSA reclaim a semaphore share.
| SemaphoreGroup | the group pointer | |
| Int | the semaphore identifier/index |
References corelinux::_CSAGroupHeader::groupInfo, corelinux::_CSAGroupHeader::groupSemCount, corelinux::_CSASemaphoreHeader::isBalking, corelinux::_CSASemaphoreHeader::isRecursive, corelinux::_CSASemaphoreHeader::maxSemValue, corelinux::_CSASemaphoreHeader::semShares, and corelinux::SemaphoreGroup::theGroupCSA.
Referenced by relinquishSemaphore().