L4Re - L4 Runtime Environment
|
Kernel-provided semaphore object. More...
Public Member Functions | |
l4_msgtag_t | up (l4_utcb_t *utcb=l4_utcb()) throw () |
Semaphore up operation (wrapper for trigger()). More... | |
l4_msgtag_t | down (l4_timeout_t timeout=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) throw () |
Semaphore down operation. More... | |
![]() | |
l4_msgtag_t | trigger (l4_utcb_t *utcb=l4_utcb()) throw () |
Trigger. More... | |
![]() | |
l4_msgtag_t | unmask (unsigned irqnum, l4_umword_t *label=0, l4_timeout_t to=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) throw () |
Acknowledge the given interrupt line. More... | |
Additional Inherited Members | |
![]() | |
typedef Semaphore | Class |
The target interface type (inheriting from Kobject_t) | |
typedef Typeid::Iface< PROTO, Semaphore > | __Iface |
The interface description for the derived class. | |
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename Triggerable ::__Iface_list > | __Iface_list |
The list of all RPC interfaces provided directly or through inheritance. | |
![]() | |
typedef Triggerable | Class |
The target interface type (inheriting from Kobject_t) | |
typedef Typeid::Iface< PROTO, Triggerable > | __Iface |
The interface description for the derived class. | |
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename Irq_eoi ::__Iface_list > | __Iface_list |
The list of all RPC interfaces provided directly or through inheritance. | |
![]() | |
L4::Cap< Class > | c () const |
Get the capability to ourselves. | |
![]() | |
L4::Cap< Class > | c () const |
Get the capability to ourselves. | |
![]() | |
static void | __check_protocols__ () |
Helper to check for protocol conflicts. | |
![]() | |
static void | __check_protocols__ () |
Helper to check for protocol conflicts. | |
Kernel-provided semaphore object.
This is the interface for kernel-provided semaphore objects. The object provides the classical functions up()
and down()
for counting the semaphore and blocking. The semaphore is a Triggerable with respect to the up()
function, this means that a semaphore can be bound to an interrupt line at an ICU (L4::Icu) and incoming interrupts increment the semaphore counter.
The down()
method decrements the semaphore counter and blocks if the counter is already zero. Blocking on a semaphore may—as all blocking operations—either return successfully, or be aborted due to an expired timeout provided to the down()
operation, or due to an L4::Thread::ex_regs() operation with the L4_THREAD_EX_REGS_CANCEL flag set.
The main reason for using a semaphore instead of an L4::Irq is to ensure that incoming trigger signals do not interfere with any open-wait operations, as used for example in a server loop.
|
inline |
Semaphore down operation.
timeout | Timeout for blocking the semaphore down operation. Note: The receive timeout of this timeout-pair is significant for blocking, the send part is usually non-blocking. |
utcb | UTCB to be used for this operation, usually the UTCB of the calling thread. |
This method decrements the semaphore counter by one, or blocks if the counter is already zero, until either a timeout or cancel condition hits or the counter is increased by an up()
operation.
Definition at line 84 of file semaphore.
References L4::Kobject::cap().
|
inline |
Semaphore up operation (wrapper for trigger()).
utcb | UTCB to be used for this operation, usually the UTCB of the calling thread. |
Increases the semaphore counter by one if it is smaller than an unspecified limit. The unspecified limit is guaranteed to be at least 2^31-1.
Definition at line 65 of file semaphore.
References L4::Triggerable::trigger().