L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
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 * This file is part of TUD:OS and distributed under the terms of the
10 * GNU General Public License 2.
11 * Please see the COPYING-GPL-2 file for details.
12 *
13 * As a special exception, you may use this file as part of a free software
14 * library without restriction. Specifically, if other files instantiate
15 * templates or use macros or inline functions from this file, or you compile
16 * this file and link it with other files to produce an executable, this
17 * file does not by itself cause the resulting executable to be covered by
18 * the GNU General Public License. This exception does not however
19 * invalidate any other reasons why the executable file might be covered by
20 * the GNU General Public License.
21 */
22
23#pragma once
24
25#include <l4/sys/irq>
26#include <l4/sys/semaphore.h>
27
28namespace L4 {
29
52struct Semaphore : Kobject_t<Semaphore, Triggerable, L4_PROTO_SEMAPHORE>
53{
68 l4_msgtag_t up(l4_utcb_t *utcb = l4_utcb()) noexcept
69 { return trigger(utcb); }
70
89 l4_utcb_t *utcb = l4_utcb()) noexcept
90 { return l4_semaphore_down_u(cap(), timeout, utcb); }
91};
92
93}
Helper class to create an L4Re interface class that is derived from a single base class.
Definition __typeinfo.h:760
#define L4_IPC_NEVER
never timeout
Definition __timeout.h:82
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:67
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:340
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:53
l4_msgtag_t up(l4_utcb_t *utcb=l4_utcb()) noexcept
Semaphore up operation (wrapper for trigger()).
Definition semaphore:68
l4_msgtag_t down(l4_timeout_t timeout=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb()) noexcept
Semaphore down operation.
Definition semaphore:88
l4_msgtag_t trigger(l4_utcb_t *utcb=l4_utcb()) noexcept
Trigger the object.
Definition irq:102
Message tag data structure.
Definition types.h:163
Timeout pair.
Definition __timeout.h:59