]> git.sur5r.net Git - openldap/commitdiff
Fix WAKE_LISTENER hang in single-threaded server
authorHoward Chu <hyc@openldap.org>
Thu, 2 Dec 1999 03:45:54 +0000 (03:45 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 2 Dec 1999 03:45:54 +0000 (03:45 +0000)
servers/slapd/daemon.c

index b88f1e2b9abf0225c29eb7686247f8cd44bc5edf..823e6bd0b31aa93f8947431b90b5c68ec078fb82 100644 (file)
@@ -45,8 +45,14 @@ Listener **slap_listeners = NULL;
 
 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) \
 do { if (w) tcp_write( wake_sds[1], "0", 1 ); } while(0)
+#endif
 
 #ifdef HAVE_NT_SERVICE_MANAGER
 /* in nt_main.c */
@@ -594,6 +600,9 @@ slapd_daemon_task(
                if( FD_ISSET( wake_sds[0], &readfds ) ) {
                        char c[BUFSIZ];
                        tcp_read( wake_sds[0], c, sizeof(c) );
+#ifdef NO_THREADS
+                       waking = 0;
+#endif
                        continue;
                }