SIMLIB/C++
3.07
|
basic synchronization tool for processes simplified implementation More...
#include <simlib.h>
Public Member Functions | |
Semaphore () | |
Semaphore (const char *_name) | |
virtual | ~Semaphore () |
void | Clear () |
initialization More... | |
virtual void | Output () const override |
print object to default output More... | |
virtual void | P () |
P operation. More... | |
virtual void | V () |
V operation. More... | |
![]() | |
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... | |
Public Attributes | |
Queue | Q |
internal quqeue More... | |
Protected Attributes | |
int | n |
![]() | |
unsigned | _flags |
bool flags for internal use (TODO bitfield?) More... | |
Additional Inherited Members | |
![]() | |
enum | _Flags { _CLEAR_ALL_FLAGS = 0, _ALLOCATED_FLAG = 1<<0, _EVAL_FLAG = 1<<1, _HAS_NAME_FLAG = 1<<2 } |
basic synchronization tool for processes simplified implementation
simlib3::Semaphore::Semaphore | ( | ) |
Definition at line 33 of file semaphor.cc.
|
explicit |
Definition at line 39 of file semaphor.cc.
References Dprintf, n, and simlib3::SimObject::SetName().
|
virtual |
Definition at line 50 of file semaphor.cc.
References Dprintf, n, and simlib3::SimObject::Name().
void simlib3::Semaphore::Clear | ( | ) |
initialization
Definition at line 59 of file semaphor.cc.
References simlib3::Queue::Clear(), Dprintf, n, simlib3::SimObject::Name(), and Q.
|
overridevirtual |
print object to default output
print object's info TODO: use operator <<
Reimplemented from simlib3::SimObject.
Definition at line 69 of file semaphor.cc.
References n, simlib3::SimObject::Name(), and simlib3::Print().
|
virtual |
P operation.
Definition at line 77 of file semaphor.cc.
References simlib3::Current, Dprintf, simlib3::Queue::Get(), simlib3::Queue::Insert(), n, simlib3::SimObject::Name(), simlib3::Passivate(), and Q.
|
virtual |
V operation.
Definition at line 92 of file semaphor.cc.
References simlib3::Entity::Activate(), Dprintf, simlib3::Queue::front(), n, simlib3::SimObject::Name(), Q, simlib3::SemaphoreError, and simlib3::SIMLIB_error().
|
protected |
Definition at line 1759 of file simlib.h.
Referenced by Clear(), Output(), P(), Semaphore(), V(), and ~Semaphore().
Queue simlib3::Semaphore::Q |