static int put_rc;
static int use_thread = 0; /*FIXME need a new switch for this */
-static int put_wait;
static void *do_put(void *ptr)
{
Entry *e;
int lineno;
-
do {
+ ldap_pvt_thread_mutex_lock( &put_mutex );
ldap_pvt_thread_cond_wait( &put_cond, &put_mutex );
- if ( put_rc ) break;
+ if ( put_rc ) {
+ ldap_pvt_thread_mutex_unlock( &put_mutex );
+ break;
+ }
e = put_e;
lineno = put_lineno;
entry_free( e );
if ( continuemode ) continue;
put_rc = EXIT_FAILURE;
+ ldap_pvt_thread_mutex_unlock( &put_mutex );
break;
}
}
}
entry_free( e );
- ldap_pvt_thread_cond_signal( &put_cond );
+ ldap_pvt_thread_mutex_unlock( &put_mutex );
} while (1);
}
}
if ( use_thread ) {
- if ( put_wait ) {
- ldap_pvt_thread_cond_wait( &put_cond, &put_mutex );
- if (put_rc) {
- rc = put_rc;
- break;
- }
+ ldap_pvt_thread_mutex_lock( &put_mutex );
+ if (put_rc) {
+ rc = put_rc;
+ break;
}
put_e = e;
put_lineno = lineno;
- put_wait = 1;
ldap_pvt_thread_cond_signal( &put_cond );
+ ldap_pvt_thread_mutex_unlock( &put_mutex );
continue;
}
if ( use_thread ) {
put_rc = EXIT_FAILURE;
+ ldap_pvt_thread_mutex_lock( &put_mutex );
ldap_pvt_thread_cond_signal( &put_cond );
+ ldap_pvt_thread_mutex_unlock( &put_mutex );
ldap_pvt_thread_join( put_tid, NULL );
}