Xenomai 3.3.2
Loading...
Searching...
No Matches
cond.h
1/*
2 * Copyright (C) 2011 Philippe Gerum <rpm@xenomai.org>.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 */
18#ifndef _XENOMAI_ALCHEMY_COND_H
19#define _XENOMAI_ALCHEMY_COND_H
20
21#include <stdint.h>
22#include <alchemy/timer.h>
23#include <alchemy/mutex.h>
24
30struct RT_COND {
31 uintptr_t handle;
32};
33
34typedef struct RT_COND RT_COND;
35
47 char name[XNOBJECT_NAME_LEN];
48};
49
50typedef struct RT_COND_INFO RT_COND_INFO;
51
52#ifdef __cplusplus
53extern "C" {
54#endif
55
56int rt_cond_create(RT_COND *cond,
57 const char *name);
58
59int rt_cond_delete(RT_COND *cond);
60
61int rt_cond_signal(RT_COND *cond);
62
63int rt_cond_broadcast(RT_COND *cond);
64
65int rt_cond_wait_timed(RT_COND *cond,
66 RT_MUTEX *mutex,
67 const struct timespec *abs_timeout);
68static inline
69int rt_cond_wait_until(RT_COND *cond, RT_MUTEX *mutex, RTIME timeout)
70{
71 struct timespec ts;
72 return rt_cond_wait_timed(cond, mutex,
73 alchemy_abs_timeout(timeout, &ts));
74}
75
76static inline
77int rt_cond_wait(RT_COND *cond, RT_MUTEX *mutex, RTIME timeout)
78{
79 struct timespec ts;
80 return rt_cond_wait_timed(cond, mutex,
81 alchemy_rel_timeout(timeout, &ts));
82}
83
84int rt_cond_inquire(RT_COND *cond,
85 RT_COND_INFO *info);
86
87int rt_cond_bind(RT_COND *cond,
88 const char *name, RTIME timeout);
89
90int rt_cond_unbind(RT_COND *cond);
91
92#ifdef __cplusplus
93}
94#endif
95
98#endif /* _XENOMAI_ALCHEMY_COND_H */
int rt_cond_create(RT_COND *cond, const char *name)
Create a condition variable.
Definition cond.c:113
static int rt_cond_wait_until(RT_COND *cond, RT_MUTEX *mutex, RTIME timeout)
Wait on a condition variable (with absolute scalar timeout).
Definition cond.h:69
int rt_cond_broadcast(RT_COND *cond)
Broadcast a condition variable.
Definition cond.c:270
static int rt_cond_wait(RT_COND *cond, RT_MUTEX *mutex, RTIME timeout)
Wait on a condition variable (with relative scalar timeout).
Definition cond.h:77
int rt_cond_unbind(RT_COND *cond)
Unbind from a condition variable.
Definition cond.c:491
int rt_cond_wait_timed(RT_COND *cond, RT_MUTEX *mutex, const struct timespec *abs_timeout)
Wait on a condition variable.
Definition cond.c:364
int rt_cond_bind(RT_COND *cond, const char *name, RTIME timeout)
Bind to a condition variable.
Definition cond.c:469
int rt_cond_signal(RT_COND *cond)
Signal a condition variable.
Definition cond.c:242
int rt_cond_delete(RT_COND *cond)
Delete a condition variable.
Definition cond.c:196
int rt_cond_inquire(RT_COND *cond, RT_COND_INFO *info)
Query condition variable status.
Definition cond.c:411
Condition variable status descriptor .
Definition cond.h:43
char name[XNOBJECT_NAME_LEN]
Name of condition variable.
Definition cond.h:47