/* Posix threads interface */
#include <stdlib.h>
+#include <string.h>
#include <pthread.h>
pthread_mutex_t mut;
} pthread_lock;
-#define CHECK_STATUS(name) if (status < 0) { perror(name); error=1; }
+#define CHECK_STATUS(name) if (status != 0) { perror(name); error = 1; }
/*
* Initialization.
*/
+
+#ifdef _HAVE_BSDI
+static void _noop()
+{
+}
+
+static void _init_thread _P0()
+{
+ /* DO AN INIT BY STARTING THE THREAD */
+ static int dummy = 0;
+ pthread_t thread1;
+ pthread_create(&thread1, NULL, (void *) _noop, &dummy);
+ pthread_join(thread1, NULL);
+}
+
+#else /* !_HAVE_BSDI */
+
static void _init_thread _P0()
{
#if defined(_AIX) && defined(__GNUC__)
#endif
}
+#endif /* !_HAVE_BSDI */
+
/*
* Thread support.
*/
init_thread();
lock = (pthread_lock *) malloc(sizeof(pthread_lock));
+ memset((void *)lock, '\0', sizeof(pthread_lock));
if (lock) {
lock->locked = 0;