include/native/cond.h

Go to the documentation of this file.
00001 
00022 #ifndef _XENO_COND_H
00023 #define _XENO_COND_H
00024 
00025 #include <nucleus/synch.h>
00026 #include <native/mutex.h>
00027 
00028 typedef struct rt_cond_info {
00029 
00030     int nwaiters;       /* !< Number of pending tasks. */
00031 
00032     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
00033 
00034 } RT_COND_INFO;
00035 
00036 typedef struct rt_cond_placeholder {
00037     xnhandle_t opaque;
00038 } RT_COND_PLACEHOLDER;
00039 
00040 #if defined(__KERNEL__) || defined(__XENO_SIM__)
00041 
00042 #define XENO_COND_MAGIC 0x55550606
00043 
00044 typedef struct rt_cond {
00045 
00046     unsigned magic;   /* !< Magic code - must be first */
00047 
00048     xnsynch_t synch_base; /* !< Base synchronization object. */
00049 
00050     xnhandle_t handle;  /* !< Handle in registry -- zero if unregistered. */
00051 
00052     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
00053 
00054 #if defined(__KERNEL__) && defined(CONFIG_XENO_OPT_PERVASIVE)
00055     pid_t cpid;                 /* !< Creator's pid. */
00056 #endif /* __KERNEL__ && CONFIG_XENO_OPT_PERVASIVE */
00057 
00058 } RT_COND;
00059 
00060 #ifdef __cplusplus
00061 extern "C" {
00062 #endif
00063 
00064 int __native_cond_pkg_init(void);
00065 
00066 void __native_cond_pkg_cleanup(void);
00067 
00068 #ifdef __cplusplus
00069 }
00070 #endif
00071 
00072 #else /* !(__KERNEL__ || __XENO_SIM__) */
00073 
00074 typedef RT_COND_PLACEHOLDER RT_COND;
00075 
00076 #ifdef __cplusplus
00077 extern "C" {
00078 #endif
00079 
00080 int rt_cond_bind(RT_COND *cond,
00081                  const char *name,
00082                  RTIME timeout);
00083 
00084 static inline int rt_cond_unbind (RT_COND *cond)
00085 
00086 {
00087     cond->opaque = XN_NO_HANDLE;
00088     return 0;
00089 }
00090 
00091 #ifdef __cplusplus
00092 }
00093 #endif
00094 
00095 #endif /* __KERNEL__ || __XENO_SIM__ */
00096 
00097 #ifdef __cplusplus
00098 extern "C" {
00099 #endif
00100 
00101 /* Public interface. */
00102 
00103 int rt_cond_create(RT_COND *cond,
00104                    const char *name);
00105 
00106 int rt_cond_delete(RT_COND *cond);
00107 
00108 int rt_cond_signal(RT_COND *cond);
00109 
00110 int rt_cond_broadcast(RT_COND *cond);
00111 
00112 int rt_cond_wait(RT_COND *cond,
00113                  RT_MUTEX *mutex,
00114                  RTIME timeout);
00115 
00116 int rt_cond_inquire(RT_COND *cond,
00117                     RT_COND_INFO *info);
00118 
00119 #ifdef __cplusplus
00120 }
00121 #endif
00122 
00123 #endif /* !_XENO_COND_H */

Generated on Mon Dec 25 13:57:10 2006 for Xenomai API by  doxygen 1.4.6