cond.h

Go to the documentation of this file.
00001 
00022 #ifndef _RTAI_COND_H
00023 #define _RTAI_COND_H
00024 
00025 #include <nucleus/synch.h>
00026 #include <rtai/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     rt_handle_t opaque;
00038 } RT_COND_PLACEHOLDER;
00039 
00040 #if defined(__KERNEL__) || defined(__RTAI_SIM__)
00041 
00042 #define RTAI_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     rt_handle_t handle; /* !< Handle in registry -- zero if unregistered. */
00051 
00052     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
00053 
00054 #if defined(__KERNEL__) && defined(CONFIG_RTAI_OPT_FUSION)
00055     pid_t cpid;                 /* !< Creator's pid. */
00056 #endif /* __KERNEL__ && CONFIG_RTAI_OPT_FUSION */
00057 
00058 } RT_COND;
00059 
00060 #ifdef __cplusplus
00061 extern "C" {
00062 #endif
00063 
00064 int __cond_pkg_init(void);
00065 
00066 void __cond_pkg_cleanup(void);
00067 
00068 #ifdef __cplusplus
00069 }
00070 #endif
00071 
00072 #else /* !(__KERNEL__ || __RTAI_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 
00083 static inline int rt_cond_unbind (RT_COND *cond)
00084 
00085 {
00086     cond->opaque = RT_HANDLE_INVALID;
00087     return 0;
00088 }
00089 
00090 #ifdef __cplusplus
00091 }
00092 #endif
00093 
00094 #endif /* __KERNEL__ || __RTAI_SIM__ */
00095 
00096 #ifdef __cplusplus
00097 extern "C" {
00098 #endif
00099 
00100 /* Public interface. */
00101 
00102 int rt_cond_create(RT_COND *cond,
00103                    const char *name);
00104 
00105 int rt_cond_delete(RT_COND *cond);
00106 
00107 int rt_cond_signal(RT_COND *cond);
00108 
00109 int rt_cond_broadcast(RT_COND *cond);
00110 
00111 int rt_cond_wait(RT_COND *cond,
00112                  RT_MUTEX *mutex,
00113                  RTIME timeout);
00114 
00115 int rt_cond_inquire(RT_COND *cond,
00116                     RT_COND_INFO *info);
00117 
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121 
00122 #endif /* !_RTAI_COND_H */

Generated on Wed Jun 22 22:54:02 2005 for RTAI Fusion API by  doxygen 1.4.1