L4Re - L4 Runtime Environment
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 
28 namespace L4 {
29 
51 struct Semaphore : Kobject_t<Semaphore, Triggerable, L4_PROTO_SEMAPHORE>
52 {
65  l4_msgtag_t up(l4_utcb_t *utcb = l4_utcb()) throw()
66  { return trigger(utcb); }
67 
85  l4_utcb_t *utcb = l4_utcb()) throw()
86  { return l4_semaphore_down_u(cap(), timeout, utcb); }
87 };
88 
89 }
Kernel-provided semaphore object.
Definition: semaphore:51
L4 low-level kernel interface.
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition: utcb.h:67
#define L4_IPC_NEVER
never timeout
Definition: __timeout.h:80
Timeout pair.
Definition: __timeout.h:57
l4_msgtag_t up(l4_utcb_t *utcb=l4_utcb())
Semaphore up operation (wrapper for trigger()).
Definition: semaphore:65
l4_msgtag_t trigger(l4_utcb_t *utcb=l4_utcb())
Trigger.
Definition: irq:93
l4_msgtag_t down(l4_timeout_t timeout=L4_IPC_NEVER, l4_utcb_t *utcb=l4_utcb())
Semaphore down operation.
Definition: semaphore:84
C++ Irq interface.
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition: utcb.h:340
l4_cap_idx_t cap() const
Return capability selector.
Definition: kobject:79
Helper class to create an L4Re interface class that is derived from a single base class...
Definition: __typeinfo.h:759
Message tag data structure.
Definition: types.h:159