ITS#2820 fix from HEAD - fix Draft 4 pthread_create, use pthread_equal

This commit is contained in:
Howard Chu 2003-11-13 03:35:57 +00:00
parent acc060b592
commit a411086103
2 changed files with 13 additions and 2 deletions

View 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

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