5 #if !defined(_KKU_GOALKEEPER_) 6 #define _KKU_GOALKEEPER_ 15 #include <semaphore.h> 45 GoalKeeper (
const KKStr& _name);
152 void CriticalSectionStart ();
154 void CriticalSectionEnd ();
157 volatile bool blocked;
173 #if defined(GOALKEEPER_DEBUG) 193 #define _GoalKeeper_Defined_ GoalKeeper * GoalKeeperPtr
kkint32 BlockerThreadId()
ThreadId of thread that currently holds the Block -1 indicates no Block.
static void CreateAndStartBlock(const KKStr &_name, volatile GoalKeeperPtr &_newGoalKeeper, bool &_didNotExistYet)
Create a GoalKeeper object and avoid a race condition doing it.
static void Destroy(volatile GoalKeeperPtr &_goalKeeperInstance)
Destroys an existing instance of GoalKeeper.
kkint32 MemoryConsumedEstimated() const
const KKStr & Name() const
bool Blocked()
Will return true if any thread lock on this instance of "GoalKeeper".
static void Create(const KKStr &_name, volatile GoalKeeperPtr &_newGoalKeeper)
Create a GoalKeeper object and avoid a race condition doing it.
GoalKeeperList(bool _owner)
void StartBlock()
Initiates a Block as long as another thread has not already locked this object.
void EndBlock()
Ends the block and allows other threads to pass through StatBlock.
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of 'std::string' strings.
static void FinalCleanUp()
Will be registered with 'atexit' so that it will be called when program is unloaded from memory...
friend std::ostream & operator<<(std::ostream &os, const Matrix &matrix)
kkint32 NumBlockedThreads()
Returns the number of threads that are waiting to establish a lock on this instance.
GoalKeeperList * GoalKeeperListPtr
bool BlockedByAnotherThread()
Returns true if a different thread has this instance of "GoalKeeper" locked.