]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
join with pthread-d4, branch is kept for further devel -- mm
authormuench <muench>
Mon, 17 Feb 2003 12:06:57 +0000 (12:06 +0000)
committermuench <muench>
Mon, 17 Feb 2003 12:06:57 +0000 (12:06 +0000)
compat/pthread.c
compat/pthread.h

index f4984ebee7f5cf3b0e53f2e8c1b47b4954451fa2..6ad9d844528e094a04ea3ec5d7ec89e31da044f1 100644 (file)
@@ -5,22 +5,32 @@ static const char rcsId[] = "$Header$";
 
 #include </usr/include/pthread.h>
 
+int PTHREAD_pthread_detach(pthread_t thread)
+{
+       return pthread_detach(&thread);
+}
+
 int PTHREAD_pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr)
 {
        return pthread_mutex_init(mutex, mutexattr == NULL ? pthread_mutexattr_default : mutexattr);
 }
 
-int  PTHREAD_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
+int PTHREAD_pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *condattr)
 {
-       pthread_attr_t P_attr;
+       return pthread_cond_init(cond, condattr == NULL ? pthread_condattr_default : condattr);
+}
 
-       P_attr = attr == NULL ? pthread_attr_default : *attr;
-       return pthread_create(thread, P_attr, start_routine, arg);
+int PTHREAD_pthread_attr_destroy(pthread_attr_t *attr)
+{
+       pthread_attr_delete(attr);
 }
 
-int PTHREAD_pthread_detach(pthread_t thread)
+int PTHREAD_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
 {
-       return pthread_detach(&thread);
+       pthread_attr_t P_attr;
+
+       P_attr = attr == NULL ? pthread_attr_default : *attr;
+       return pthread_create(thread, P_attr, start_routine, arg);
 }
 
 int PTHREAD_pthread_key_create(pthread_key_t *key, void (*destr_function) (void 
index 2d1a3a3ae1b6b3830828292f4101e67c8708cbf7..365d1829b320fb1726d543e0eeb98a6ed4dc8ada 100644 (file)
@@ -1,24 +1,43 @@
 #ifndef OUR_PTHREAD_H
 #define OUR_PTHREAD_H
 
+/*
+Translate pthread calls conforming to the final POSIX standard (1003.1c)
+to the older draft version 1003.4b.  The latter one is e.g. used by
+LynxOS 2.5.  The translation is done according to Appendix B in
+"Nichols, Buttlar, Farrell: Pthreads Programming (O'Reilly)".
+*/
+
 #include </usr/include/pthread.h>
 
+/* Detaching a Thread */
+#ifdef pthread_detach
+#undef pthread_detach
+#endif
+#define pthread_detach PTHREAD_pthread_detach
+
 /* Mutex Variables */
 #ifdef pthread_mutex_init
 #undef pthread_mutex_init
 #endif
 #define pthread_mutex_init PTHREAD_pthread_mutex_init
 
-/* Thread Functions */
+/* Condition Variables */
+#ifdef pthread_cond_init
+#undef pthread_cond_init
+#endif
+#define pthread_cond_init PTHREAD_pthread_cond_init
+
+/* Thread Attributes */
 #ifdef pthread_create
 #undef pthread_create
 #endif
 #define pthread_create PTHREAD_pthread_create
 
-#ifdef pthread_detach
-#undef pthread_detach
+#ifdef pthread_attr_destroy
+#undef pthread_attr_destroy
 #endif
-#define pthread_detach PTHREAD_pthread_detach
+#define pthread_attr_destroy PTHREAD_pthread_attr_destroy
 
 /* The pthread_once Function */
 #define PTHREAD_ONCE_INIT pthread_once_init
 #endif
 #define pthread_getspecific PTHREAD_pthread_getspecific
 
-int PTHREAD_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);
 int PTHREAD_pthread_detach(pthread_t thread);
+int PTHREAD_pthread_attr_destroy(pthread_attr_t *attr);
+int PTHREAD_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);
 int PTHREAD_pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr);
+int PTHREAD_pthread_cond_init(pthread_cond_t *mutex, const pthread_condattr_t *condattr);
 int PTHREAD_pthread_key_create(pthread_key_t *key, void (*destr_function) (void *));
 int PTHREAD_pthread_key_delete(pthread_key_t key);
 void *PTHREAD_pthread_getspecific(pthread_key_t key);