Fix WAKE_LISTENER hang in single-threaded server

This commit is contained in:
Howard Chu 1999-12-02 03:45:54 +00:00
parent 7eec31c8f6
commit d1841b5c1f

View File

@ -45,8 +45,14 @@ Listener **slap_listeners = NULL;
static ber_socket_t wake_sds[2]; static ber_socket_t wake_sds[2];
#ifdef NO_THREADS
static int waking;
#define WAKE_LISTENER(w) \
((w && !waking) ? tcp_write( wake_sds[1], "0", 1 ), waking=1 : 0)
#else
#define WAKE_LISTENER(w) \ #define WAKE_LISTENER(w) \
do { if (w) tcp_write( wake_sds[1], "0", 1 ); } while(0) do { if (w) tcp_write( wake_sds[1], "0", 1 ); } while(0)
#endif
#ifdef HAVE_NT_SERVICE_MANAGER #ifdef HAVE_NT_SERVICE_MANAGER
/* in nt_main.c */ /* in nt_main.c */
@ -594,6 +600,9 @@ slapd_daemon_task(
if( FD_ISSET( wake_sds[0], &readfds ) ) { if( FD_ISSET( wake_sds[0], &readfds ) ) {
char c[BUFSIZ]; char c[BUFSIZ];
tcp_read( wake_sds[0], c, sizeof(c) ); tcp_read( wake_sds[0], c, sizeof(c) );
#ifdef NO_THREADS
waking = 0;
#endif
continue; continue;
} }