From: Kurt Zeilenga Date: Fri, 4 Jun 1999 01:05:29 +0000 (+0000) Subject: Move WAKE_LISTENER call behind &connection_mutex to eliminate X-Git-Tag: OPENLDAP_REL_ENG_2_BP~409 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5b218b76718546e5ef0172b4e811b933b66ac434;p=openldap Move WAKE_LISTENER call behind &connection_mutex to eliminate race condition on file descriptor sets. --- diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 86410a54fc..a0f6a0b11b 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -114,46 +114,44 @@ void slapd_remove(int s) { void slapd_clr_write(int s, int wake) { ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex ); + WAKE_LISTENER; assert( FD_ISSET( (unsigned) s, &slap_daemon.sd_actives) ); FD_CLR( (unsigned) s, &slap_daemon.sd_writers ); ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); - - WAKE_LISTENER; } void slapd_set_write(int s, int wake) { ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex ); + WAKE_LISTENER; + assert( FD_ISSET( s, &slap_daemon.sd_actives) ); FD_SET( (unsigned) s, &slap_daemon.sd_writers ); ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); - - WAKE_LISTENER; } void slapd_clr_read(int s, int wake) { ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex ); + WAKE_LISTENER; assert( FD_ISSET( s, &slap_daemon.sd_actives) ); FD_CLR( (unsigned) s, &slap_daemon.sd_readers ); ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); - WAKE_LISTENER; } void slapd_set_read(int s, int wake) { ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex ); + WAKE_LISTENER; assert( FD_ISSET( s, &slap_daemon.sd_actives) ); FD_SET( (unsigned) s, &slap_daemon.sd_readers ); ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex ); - - WAKE_LISTENER; } static void slapd_close(int s) {