Loading...
Searching...
No Matches
Kernel-provided semaphore
Base API » Kernel Objects

C semaphore interface, see L4::Semaphore for the C++ interface. More...

Collaboration diagram for Kernel-provided semaphore:

## Functions

l4_msgtag_t | l4_semaphore_up (l4_cap_idx_t sem) L4_NOTHROW
| Semaphore up operation (wrapper for trigger()).
l4_msgtag_t | l4_semaphore_down (l4_cap_idx_t sem, l4_timeout_t timeout) L4_NOTHROW
| Semaphore down operation.

## Detailed Description

C semaphore interface, see L4::Semaphore for the C++ interface.

Include File
  #include <l4/sys/semaphore.h>
  semaphore.h
  C semaphore interface.

## Function Documentation

## l4_semaphore_down()

l4_msgtag_t l4_semaphore_down | ( | l4_cap_idx_t | sem,
|  | l4_timeout_t | timeout )

inline

Semaphore down operation.

Parameters

  sem | Semaphore object.
  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.

Returns
  Syscall return tag. Use l4_error() to check for errors.

Return values

  -L4_EPERM | Insufficient permissions; see precondition.

Precondition
  The capability sem must have the permission L4_CAP_FPAGE_S.

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 100 of file semaphore.h.

References L4_NOTHROW, and l4_utcb().

Here is the call graph for this function:

## l4_semaphore_up()

l4_msgtag_t l4_semaphore_up | ( | l4_cap_idx_t | sem | ) |

inline

Semaphore up operation (wrapper for trigger()).

Parameters

  sem | Semaphore object.

Returns
  Send-only IPC message return tag. Use l4_ipc_error() to check for errors, do not use l4_error().

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 45 of file semaphore.h.

References l4_irq_trigger(), and L4_NOTHROW.

Here is the call graph for this function: