scc
2022.4.0
SystemC components library
|
The ordered_semaphore primitive channel class. More...
#include <ordered_semaphore.h>
Classes | |
struct | lock |
a lock for the semaphore More... | |
Public Member Functions | |
ordered_semaphore (unsigned init_value=1) | |
constructor of an un-named semaphore More... | |
ordered_semaphore (const char *name, unsigned init_value=1, bool value_traceable=false) | |
ordered_semaphore (const ordered_semaphore &)=delete | |
ordered_semaphore & | operator= (const ordered_semaphore &)=delete |
int | wait () override |
lock (take) the semaphore, block if not available More... | |
int | wait (unsigned priority) |
int | trywait () override |
lock (take) the semaphore, return -1 if not available More... | |
int | post () override |
unlock (give) the semaphore More... | |
unsigned | get_capacity () |
retrieve the initial capacity of the semaphore | |
void | set_capacity (unsigned capacity) |
change the capacity More... | |
int | get_value () const override |
get the value of the semaphore More... | |
const char * | kind () const override |
kind of this SastemC object More... | |
void | trace (sc_core::sc_trace_file *tf) const override |
adds internal variables to trace More... | |
bool | is_trace_enabled () const override |
returns of this component shall be traced More... | |
Protected Member Functions | |
bool | in_use () |
void | report_error (const char *id, const char *add_msg=0) const |
Protected Attributes | |
sc_core::sc_event | free_evt |
int | value |
unsigned | capacity |
bool | value_traceable = false |
std::array< std::deque< sc_core::sc_process_handle >, 2 > | queue |
The ordered_semaphore primitive channel class.
The ordered semaphore acts like an ordinary semaphore. It gives the guarantee that access is granted in the order of arrival (FCFS)
Definition at line 44 of file ordered_semaphore.h.
|
explicit |
constructor of an un-named semaphore
If the initial value is 0 the semaphore has an unlimited capacity but is initially empty
init_value | initial capacity of the semaphore |
Definition at line 62 of file ordered_semaphore.cpp.
|
inlineoverride |
get the value of the semaphore
Definition at line 115 of file ordered_semaphore.h.
|
inlineoverridevirtual |
returns of this component shall be traced
Reimplemented from scc::traceable.
Definition at line 136 of file ordered_semaphore.h.
|
inlineoverride |
|
override |
unlock (give) the semaphore
Definition at line 103 of file ordered_semaphore.cpp.
void scc::ordered_semaphore::set_capacity | ( | unsigned | capacity | ) |
change the capacity
capacity | the new capacity |
Definition at line 41 of file ordered_semaphore.cpp.
|
override |
adds internal variables to trace
tf | the trace file to register with |
Definition at line 53 of file ordered_semaphore.cpp.
|
override |
lock (take) the semaphore, return -1 if not available
Definition at line 93 of file ordered_semaphore.cpp.
|
inlineoverride |
lock (take) the semaphore, block if not available
Definition at line 74 of file ordered_semaphore.h.