Class for Semaphore (SEM) Events (see BTF Specification Chapter 2.3.7). More...
#include <semaphore.h>
Public Types | |
enum class | Events { assigned , decrement , free , full , increment , lock , lock_used , overfull , queued , released , requestsemaphore , unlock , unlock_full , used , waiting , unknown } |
Possible types of Semaphore events. More... | |
enum class | States { free , full , overfull , used , unknown } |
Possible types of Process states. More... | |
Public Member Functions | |
Semaphore (States state=States::unknown) | |
Constructor of the class Semaphore. More... | |
ErrorCodes | doStateTransition (Events ev) |
Transitions the current state depending on the event. More... | |
Static Public Member Functions | |
static std::string | eventToString (Events ev) |
Converts the enum Events into string. More... | |
static Events | stringToEvent (const std::string &str) |
Converts a string into the enum Events. More... | |
Class for Semaphore (SEM) Events (see BTF Specification Chapter 2.3.7).
If more than one process is able to access a common resource, it might be necessary to
restrict the maximum amount of accesses in order to protect this resource from race conditions.
Therefore, the operating system provides the possibility to use a semaphore (SEM) (e.g. spinlock).
|
strong |
Possible types of Semaphore events.
|
strong |
Possible types of Process states.
Enumerator | |
---|---|
free | Semaphore has no assigned users. |
full | Semaphore has assigned requests and has reached its maximum amount of simultaneous accesses. |
overfull | Semaphore is locked and at least one request is waiting for the semaphore. |
used | Semaphore has assigned requests and is still able to handle at least one request. |
unknown | Default state. |
btf::Semaphore::Semaphore | ( | States | state = States::unknown | ) |
Constructor of the class Semaphore.
ErrorCodes btf::Semaphore::doStateTransition | ( | Events | ev | ) |
Transitions the current state depending on the event.
[in] | ev | Events enum that triggered the state transition. |
|
static |
Converts the enum Events into string.
[in] | ev | Events enum that will be converted. |
|
static |
Converts a string into the enum Events.
[in] | str | String that will be converted. |