#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
#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);