skins/rtai/mutex.h

Go to the documentation of this file.
00001 00049 #ifndef _RTAI_MUTEX_H 00050 #define _RTAI_MUTEX_H 00051 00052 #include <nucleus/synch.h> 00053 #include <rtai/types.h> 00054 00055 struct RT_TASK; 00056 00057 typedef struct rt_mutex_info { 00058 00059 int lockcnt; /* !< Lock nesting level (> 0 means "locked"). */ 00060 00061 int nsleepers; /* !< Number of pending tasks. */ 00062 00063 char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */ 00064 00065 } RT_MUTEX_INFO; 00066 00067 typedef struct rt_mutex_placeholder { 00068 rt_handle_t opaque; 00069 } RT_MUTEX_PLACEHOLDER; 00070 00071 #if defined(__KERNEL__) || defined(__RTAI_SIM__) 00072 00073 #define RTAI_MUTEX_MAGIC 0x55550505 00074 00075 typedef struct rt_mutex { 00076 00077 unsigned magic; /* !< Magic code - must be first */ 00078 00079 xnsynch_t synch_base; /* !< Base synchronization object. */ 00080 00081 rt_handle_t handle; /* !< Handle in registry -- zero if unregistered. */ 00082 00083 RT_TASK *owner; /* !< Current mutex owner. */ 00084 00085 int lockcnt; /* !< Lock nesting level (> 0 means "locked"). */ 00086 00087 char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */ 00088 00089 } RT_MUTEX; 00090 00091 #ifdef __cplusplus 00092 extern "C" { 00093 #endif 00094 00095 int __mutex_pkg_init(void); 00096 00097 void __mutex_pkg_cleanup(void); 00098 00099 #ifdef __cplusplus 00100 } 00101 #endif 00102 00103 #else /* !(__KERNEL__ || __RTAI_SIM__) */ 00104 00105 typedef RT_MUTEX_PLACEHOLDER RT_MUTEX; 00106 00107 int rt_mutex_bind(RT_MUTEX *mutex, 00108 const char *name); 00109 00110 #endif /* __KERNEL__ || __RTAI_SIM__ */ 00111 00112 #ifdef __cplusplus 00113 extern "C" { 00114 #endif 00115 00116 /* Public interface. */ 00117 00118 int rt_mutex_create(RT_MUTEX *mutex, 00119 const char *name); 00120 00121 int rt_mutex_delete(RT_MUTEX *mutex); 00122 00123 int rt_mutex_lock(RT_MUTEX *mutex); 00124 00125 int rt_mutex_unlock(RT_MUTEX *mutex); 00126 00127 int rt_mutex_inquire(RT_MUTEX *mutex, 00128 RT_MUTEX_INFO *info); 00129 00130 #ifdef __cplusplus 00131 } 00132 #endif 00133 00134 #endif /* !_RTAI_MUTEX_H */

Generated on Mon Aug 30 13:58:39 2004 for RTAI API by doxygen 1.3.8