L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
semaphore
Go to the documentation of this file.
1// vi:set ft=cpp: -*- Mode: C++ -*-
6/*
7 * (c) 2015 Alexander Warg <alexander.warg@kernkonzept.com>
8 *
9 * License: see LICENSE.spdx (in this directory or the directories above)
10 */
11
12#pragma once
13
14#include <l4/sys/irq>
15#include <l4/sys/semaphore.h>
16
17namespace L4 {
18
51struct Semaphore : Kobject_t<Semaphore, Triggerable, L4_PROTO_SEMAPHORE>
52{
67 l4_msgtag_t up(l4_utcb_t *utcb = l4_utcb()) noexcept
68 { return trigger(utcb); }
69
88 l4_utcb_t *utcb = l4_utcb()) noexcept
89 { return l4_semaphore_down_u(cap(), timeout, utcb); }
90};
91
92}
Helper class to create an L4Re interface class that is derived from a single base class.
Definition __typeinfo.h:750
#define L4_IPC_NEVER
never timeout
Definition __timeout.h:76
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:346
C++ Irq interface.
L4 low-level kernel interface.
C semaphore interface.
C++ Kernel-provided semaphore interface, see Kernel-provided semaphore for the C interface.
Definition semaphore:52
l4_msgtag_t up(l4_utcb_t *utcb=l4_utcb()) noexcept
Semaphore up operation (wrapper for trigger()).
Definition semaphore:67
l4_msgtag_t down(l4_timeout_t timeout=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) noexcept
Semaphore down operation.
Definition semaphore:87
l4_msgtag_t trigger(l4_utcb_t *utcb=l4_utcb()) noexcept
Trigger the object.
Definition irq:91
Message tag data structure.
Definition types.h:153
Timeout pair.
Definition __timeout.h:53