Xenomai  3.1
semLib.h
1 /*
2  * Copyright (C) 2008 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 
19 #ifndef _VXWORKS_SEMLIB_H
20 #define _VXWORKS_SEMLIB_H
21 
22 #include <pthread.h>
23 #include <copperplate/syncobj.h>
24 #include <vxworks/semLib.h>
25 
26 struct wind_sem;
27 
28 struct wind_sem_ops {
29 
30  STATUS (*take)(struct wind_sem *, int timeout);
31  STATUS (*give)(struct wind_sem *);
32  STATUS (*flush)(struct wind_sem *);
33  STATUS (*delete)(struct wind_sem *);
34 };
35 
36 struct wind_sem {
37 
38  unsigned int magic;
39  int options;
40 
41  union {
42  struct {
43  struct syncobj sobj;
44  int value;
45  int maxvalue;
46  } xsem;
47  struct {
48  pthread_mutex_t lock;
49  struct threadobj *owner;
50  int lockdepth;
51  } msem;
52  } u;
53 
54  const struct wind_sem_ops *semops;
55 };
56 
57 #endif /* _VXWORKS_SEMLIB_H */