]> 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 6f42d21f5c452dc78c92098f0b3060d348235e2d..3485406d93652ba0626294d9a6ee8211eef6200f 100644 (file)
 
 LDAP_BEGIN_DECL
 
-#if !defined( HAVE_FUNC_PTHREAD_ATTR_INIT ) && \
-       defined( HAVE_FUNC_PTHREAD_ATTR_CREATE )
+#if !defined( HAVE_PTHREAD_ATTR_INIT ) && \
+       defined( HAVE_PTHREAD_ATTR_CREATE )
 #define pthread_attr_init( a )         pthread_attr_create( a )
 #endif
 
-#if !defined( HAVE_FUNC_PTHREAD_ATTR_DESTROY ) && \
-       defined( HAVE_FUNC_PTHREAD_ATTR_DELETE )
+#if !defined( HAVE_PTHREAD_ATTR_DESTROY ) && \
+       defined( HAVE_PTHREAD_ATTR_DELETE )
 #define pthread_attr_destroy( a )      pthread_attr_delete( a )
 #endif
 
-#if !defined( HAVE_FUNC_PTHREAD_ATTR_SETDETACHSTATE ) && \
-       defined( HAVE_FUNC_PTHREAD_ATTR_SETDETACHSTATE_NP )
+#if !defined( HAVE_PTHREAD_ATTR_SETDETACHSTATE ) && \
+       defined( HAVE_PTHREAD_ATTR_SETDETACH_NP )
 #define pthread_attr_setdetachstate( a, b ) \
                                        pthread_attr_setdetach_np( a, b )
 #endif
 
+#ifndef HAVE_PTHREAD_KILL
+/* missing pthread_kill(), define prototype */
+LDAP_F void pthread_kill LDAP_P(( pthread_t tid, int sig ));
+#endif
+
 #ifndef HAVE_PTHREADS_D4
 #define pthread_mutexattr_default      NULL
 #define pthread_condattr_default       NULL
@@ -114,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;
@@ -127,7 +130,6 @@ 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
 
@@ -143,6 +145,9 @@ LDAP_END_DECL
 
 LDAP_BEGIN_DECL
 
+stkalign_t *get_stack( int *stacknop );
+void free_stack( int *stackno );
+
 typedef void   *(*VFP)();
 
 /* thread attributes and thread type */
@@ -177,6 +182,42 @@ typedef struct lwpcv {
 
 LDAP_END_DECL
 
+#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
 
 /***********************************
@@ -192,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 */