]> git.sur5r.net Git - openldap/commitdiff
ITS#2820 fix from HEAD - fix Draft 4 pthread_create, use pthread_equal
authorHoward Chu <hyc@openldap.org>
Thu, 13 Nov 2003 03:35:57 +0000 (03:35 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 13 Nov 2003 03:35:57 +0000 (03:35 +0000)
libraries/libldap_r/thr_posix.c
libraries/libldap_r/tpool.c

index 825761e33035c9e237b695c977b8dd17fc746616..ed0c9425b846a3a43860a27bdb36dfde3cde9660 100644 (file)
@@ -121,7 +121,12 @@ ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
        pthread_attr_setdetachstate(&attr, detach);
 #endif
 #endif
+
+#if HAVE_PTHREADS < 5
+       rtn = pthread_create( thread, attr, start_routine, arg );
+#else
        rtn = pthread_create( thread, &attr, start_routine, arg );
+#endif
 #if HAVE_PTHREADS > 5
        pthread_attr_destroy(&attr);
 #else
index f9ecded4d588aabf6ad07f94eafc9e4bc98cd54f..002f9a5cf710712f1a94610d2d01fd84b6299da6 100644 (file)
@@ -42,6 +42,12 @@ typedef struct ldap_int_thread_key_s {
  */
 #define        MAXKEYS 32
 
+#ifdef HAVE_PTHREADS
+#define        TID_EQ(a,b)     pthread_equal((a),(b))
+#else
+#define        TID_EQ(a,b)     ((a) == (b))
+#endif
+
 typedef struct ldap_int_thread_ctx_s {
        union {
        LDAP_STAILQ_ENTRY(ldap_int_thread_ctx_s) q;
@@ -521,8 +527,8 @@ void *ldap_pvt_thread_pool_context( ldap_pvt_thread_pool_t *tpool )
 
        ldap_pvt_thread_mutex_lock(&pool->ltp_mutex);
        LDAP_SLIST_FOREACH(ptr, &pool->ltp_active_list, ltc_next.al)
-               if (ptr != NULL && ptr->ltc_thread_id == tid) break;
-       if (ptr != NULL && ptr->ltc_thread_id != tid) {
+               if (ptr != NULL && TID_EQ(ptr->ltc_thread_id, tid)) break;
+       if (ptr != NULL && !TID_EQ(ptr->ltc_thread_id, tid)) {
                ptr = NULL;
        }
        ldap_pvt_thread_mutex_unlock(&pool->ltp_mutex);