cond.h

Go to the documentation of this file.
00001 
00049 #ifndef _RTAI_COND_H
00050 #define _RTAI_COND_H
00051 
00052 #include <nucleus/synch.h>
00053 #include <rtai/types.h>
00054 
00055 struct RT_MUTEX;
00056 
00057 typedef struct rt_cond_info {
00058 
00059     int nwaiters;       /* !< Number of pending tasks. */
00060 
00061     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
00062 
00063 } RT_COND_INFO;
00064 
00065 typedef struct rt_cond_placeholder {
00066     rt_handle_t opaque;
00067 } RT_COND_PLACEHOLDER;
00068 
00069 #if defined(__KERNEL__) || defined(__RTAI_SIM__)
00070 
00071 #define RTAI_COND_MAGIC 0x55550606
00072 
00073 typedef struct rt_cond {
00074 
00075     unsigned magic;   /* !< Magic code - must be first */
00076 
00077     xnsynch_t synch_base; /* !< Base synchronization object. */
00078 
00079     rt_handle_t handle; /* !< Handle in registry -- zero if unregistered. */
00080 
00081     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
00082 
00083 #if defined(__KERNEL__) && defined(CONFIG_RTAI_OPT_FUSION)
00084     int source;         /* !< Creator's space. */
00085 #endif /* __KERNEL__ && CONFIG_RTAI_OPT_FUSION */
00086 
00087 } RT_COND;
00088 
00089 #ifdef __cplusplus
00090 extern "C" {
00091 #endif
00092 
00093 int __cond_pkg_init(void);
00094 
00095 void __cond_pkg_cleanup(void);
00096 
00097 #ifdef __cplusplus
00098 }
00099 #endif
00100 
00101 #else /* !(__KERNEL__ || __RTAI_SIM__) */
00102 
00103 typedef RT_COND_PLACEHOLDER RT_COND;
00104 
00105 int rt_cond_bind(RT_COND *cond,
00106                  const char *name);
00107 
00108 static inline int rt_cond_unbind (RT_COND *cond)
00109 
00110 {
00111     cond->opaque = RT_HANDLE_INVALID;
00112     return 0;
00113 }
00114 
00115 #endif /* __KERNEL__ || __RTAI_SIM__ */
00116 
00117 #ifdef __cplusplus
00118 extern "C" {
00119 #endif
00120 
00121 /* Public interface. */
00122 
00123 int rt_cond_create(RT_COND *cond,
00124                    const char *name);
00125 
00126 int rt_cond_delete(RT_COND *cond);
00127 
00128 int rt_cond_signal(RT_COND *cond);
00129 
00130 int rt_cond_broadcast(RT_COND *cond);
00131 
00132 int rt_cond_wait(RT_COND *cond,
00133                  RT_MUTEX *mutex,
00134                  RTIME timeout);
00135 
00136 int rt_cond_inquire(RT_COND *cond,
00137                     RT_COND_INFO *info);
00138 
00139 #ifdef __cplusplus
00140 }
00141 #endif
00142 
00143 #endif /* !_RTAI_COND_H */

Generated on Mon Dec 13 09:49:49 2004 for RTAI API by  doxygen 1.3.9.1