]> git.sur5r.net Git - openldap/blobdiff - include/lthread.h
Update slapd to use lutil_passwd() for both user and root passwords.
[openldap] / include / lthread.h
index 123b7efa8767e2f6adddeac201c5890d60266404..3485406d93652ba0626294d9a6ee8211eef6200f 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "portable.h"
 
-#ifdef HAVE_PTHREADS
+#if defined( HAVE_PTHREADS )
 /**********************************
  *                                *
  * definitions for POSIX Threads  *
@@ -51,9 +51,7 @@ LDAP_F void pthread_kill LDAP_P(( pthread_t tid, int sig ));
 
 LDAP_END_DECL
 
-/* Do not use #elif.  K&R does not support it. */
-#else /* !HAVE_PTHREADS */
-#ifdef HAVE_MACH_CTHREADS
+#elif defined ( HAVE_MACH_CTHREADS )
 /**********************************
  *                                *
  * definitions for Mach CThreads  *
@@ -93,8 +91,7 @@ typedef struct condition pthread_cond_t;
 
 LDAP_END_DECL
 
-#else /* !HAVE_MACH_CTHREADS */
-#ifdef HAVE_THR
+#elif defined( HAVE_THR )
 /**************************************
  *                                    *
  * thread definitions for Solaris LWP *
@@ -122,8 +119,6 @@ typedef void        *(*VFP)();
 #define PTHREAD_SHARE_PRIVATE   USYNC_THREAD
 #define PTHREAD_SHARE_PROCESS   USYNC_PROCESS
 
-
-#if !defined(__SunOS_5_6)
 /* thread attributes and thread type */
 typedef int            pthread_attr_t;
 typedef thread_t       pthread_t;
@@ -135,12 +130,10 @@ typedef mutex_t   pthread_mutex_t;
 /* condition variable attributes and condition variable type */
 typedef int     pthread_condattr_t;
 typedef cond_t pthread_cond_t;
-#endif /* ! sunos56 */
 
 LDAP_END_DECL
 
-#else /* !HAVE_THR */
-#ifdef HAVE_LWP
+#elif defined( HAVE_LWP )
 /*************************************
  *                                   *
  * thread definitions for SunOS LWP  *
@@ -189,7 +182,44 @@ typedef struct lwpcv {
 
 LDAP_END_DECL
 
-#else /* !HAVE_LWP */
+#elif HAVE_NT_THREADS
+
+#include <windows.h>
+#include <process.h>
+
+typedef void   (*VFP)(void*);
+
+/* thread attributes and thread type */
+typedef int            pthread_attr_t;
+typedef HANDLE pthread_t;
+
+/* default attr states */
+#define pthread_mutexattr_default      NULL
+#define pthread_condattr_default       NULL
+
+/* thread state - joinable or not */
+#define PTHREAD_CREATE_JOINABLE 0
+#define PTHREAD_CREATE_DETACHED 0
+/* thread scope - who is in scheduling pool */
+#define PTHREAD_SCOPE_PROCESS   0
+#define PTHREAD_SCOPE_SYSTEM    0
+
+/* mutex attributes and mutex type */
+typedef int    pthread_mutexattr_t;
+typedef HANDLE pthread_mutex_t;
+
+/* mutex and condition variable scope - process or system */
+#define PTHREAD_SHARE_PRIVATE   USYNC_THREAD
+#define PTHREAD_SHARE_PROCESS   USYNC_PROCESS
+
+/* condition variable attributes and condition variable type */
+typedef int     pthread_condattr_t;
+typedef HANDLE  pthread_cond_t;
+typedef int     any_t;
+
+
+#else
+
 /***********************************
  *                                 *
  * thread definitions for no       *
@@ -203,11 +233,6 @@ LDAP_BEGIN_DECL
 #define NO_THREADS 1
 #endif
 
-#ifndef PREEMPTIVE_THREADS
-/* treat no threads as preemptive */
-#define PREEMPTIVE_THREADS 1
-#endif
-
 typedef void   *(*VFP)();
 
 /* thread attributes and thread type */
@@ -239,8 +264,5 @@ typedef int pthread_cond_t;
 
 LDAP_END_DECL
 
-#endif /* HAVE_LWP */
-#endif /* HAVE_THR */
-#endif /* HAVE_MACH_CTHREADS */
-#endif /* HAVE_PTHREADS */
+#endif /* no threads support */
 #endif /* _LTHREAD_H */