|
SIMLIB/C++
3.07
|
synchronization tool for processes More...
#include <simlib.h>


Public Member Functions | |
| Barrier (unsigned N) | |
| constructor More... | |
| Barrier (const char *_name, unsigned N) | |
| constructor with name parameter More... | |
| virtual | ~Barrier () |
| destructor More... | |
| void | ChangeHeight (unsigned new_maxn) |
| change size More... | |
| unsigned | Height () const |
| barrier size More... | |
| virtual void | Enter (Entity *e) |
| wait for barrier break TODO: remove/rename More... | |
| virtual bool | Wait () |
| wait for barrier break (Current) More... | |
| virtual int | Break () |
| activate all waiting entities More... | |
| void | Clear () |
| initialization More... | |
| virtual void | Output () const override |
| print status More... | |
Public Member Functions inherited from simlib3::SimObject | |
| bool | TestAndSetFlag (bool new_value, unsigned n) |
| internal method for flag manipulation is used for algebraic loop checking in continuous blocks More... | |
| SimObject () | |
| constructor More... | |
| virtual | ~SimObject () |
| virtual destructor More... | |
| void * | operator new (size_t size) |
| allocate object, set _flags More... | |
| void | operator delete (void *ptr) |
| deallocate object More... | |
| void * | operator new[] (size_t size)=delete |
| void | operator delete[] (void *ptr)=delete |
| bool | isAllocated () const |
| virtual std::string | Name () const |
| get object name More... | |
| bool | HasName () const |
| void | SetName (const std::string &name) |
| assign the name More... | |
Protected Member Functions | |
| void | Init () |
| initialization More... | |
Protected Attributes | |
| Entity ** | waiting |
| array of waiting entities (fixed size) More... | |
| unsigned | n |
| current number of waiting entities More... | |
| unsigned | maxn |
| barrier height/size More... | |
Protected Attributes inherited from simlib3::SimObject | |
| unsigned | _flags |
| bool flags for internal use (TODO bitfield?) More... | |
Additional Inherited Members | |
Public Types inherited from simlib3::SimObject | |
| enum | _Flags { _CLEAR_ALL_FLAGS = 0, _ALLOCATED_FLAG = 1<<0, _EVAL_FLAG = 1<<1, _HAS_NAME_FLAG = 1<<2 } |
|
explicit |
| simlib3::Barrier::Barrier | ( | const char * | _name, |
| unsigned | N | ||
| ) |
constructor with name parameter
Definition at line 42 of file barrier.cc.
References Dprintf, Init(), and simlib3::SimObject::SetName().
|
virtual |
destructor
Definition at line 54 of file barrier.cc.
References Dprintf, simlib3::SimObject::Name(), and waiting.
|
virtual |
activate all waiting entities
Activate all processes waiting on the barrier returns: number of activated entities Warning: can be called only by process not already waiting on barrier.
Definition at line 97 of file barrier.cc.
References simlib3::Entity::Activate(), n, and waiting.
| void simlib3::Barrier::ChangeHeight | ( | unsigned | new_maxn | ) |
change size
Change the height of barrier.
Definition at line 125 of file barrier.cc.
References Dprintf, simlib3::Error(), maxn, n, simlib3::SimObject::Name(), and waiting.
| void simlib3::Barrier::Clear | ( | ) |
initialization
Barrier re-initializtion TODO: what to do with currently waiting passive processes?
Definition at line 144 of file barrier.cc.
References Dprintf, maxn, n, simlib3::SimObject::Name(), and waiting.
Referenced by Init().
|
virtual |
wait for barrier break TODO: remove/rename
enter the barrier
Definition at line 62 of file barrier.cc.
References simlib3::Entity::Activate(), Break(), simlib3::Current, Dprintf, maxn, n, simlib3::SimObject::Name(), simlib3::Entity::Passivate(), and waiting.
|
inline |
barrier size
Definition at line 1787 of file simlib.h.
References simlib3::SQS::Clear(), and simlib3::SimObject::Output().
|
protected |
initialization
Barrier initializtion.
Definition at line 113 of file barrier.cc.
References Clear(), Dprintf, simlib3::Error(), maxn, simlib3::SimObject::Name(), and waiting.
Referenced by Barrier().
|
overridevirtual |
print status
Print barrier status.
Reimplemented from simlib3::SimObject.
Definition at line 154 of file barrier.cc.
References maxn, simlib3::SimObject::Name(), simlib3::Print(), and waiting.
|
virtual |
wait for barrier break (Current)
Wait or break the barrier returns: true for last process breaking the barrier, else false.
Definition at line 78 of file barrier.cc.
References simlib3::Entity::Activate(), Break(), simlib3::Current, Dprintf, maxn, n, simlib3::SimObject::Name(), simlib3::Entity::Passivate(), simlib3::Time, and waiting.
|
protected |
|
protected |
|
protected |
array of waiting entities (fixed size)
Definition at line 1778 of file simlib.h.
Referenced by Break(), ChangeHeight(), Clear(), Enter(), Init(), Output(), Wait(), and ~Barrier().
1.8.13