Upsie, usleep is 10^6 times smaller than sleep
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 16 Sep 2012 14:59:36 +0000 (16:59 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 16 Sep 2012 14:59:36 +0000 (16:59 +0200)
citadel/citserver.c
citadel/threads.c

index 211cefe8850ef4e64aee28c1e3e64aecc04aa28b..0c8955a8a2b3fb10386b589818e6a3618aff6088 100644 (file)
@@ -216,7 +216,7 @@ void master_cleanup(int exitcode) {
        struct CleanupFunctionHook *fcn;
        static int already_cleaning_up = 0;
 
        struct CleanupFunctionHook *fcn;
        static int already_cleaning_up = 0;
 
-       if (already_cleaning_up) while(1) usleep(1000);
+       if (already_cleaning_up) while(1) usleep(1000000);
        already_cleaning_up = 1;
 
        /* Run any cleanup routines registered by loadable modules */
        already_cleaning_up = 1;
 
        /* Run any cleanup routines registered by loadable modules */
index ec8fc3feb6f1ff4cce2f2b3bc16da1d09bc8dfb0..4a4fe5163ec2260335ca7e537e1a39ea7cf2f601 100644 (file)
@@ -204,7 +204,7 @@ void go_threading(void)
                if ((active_workers == num_workers) && (num_workers < 256)) {
                        CtdlThreadCreate(worker_thread);
                }
                if ((active_workers == num_workers) && (num_workers < 256)) {
                        CtdlThreadCreate(worker_thread);
                }
-               usleep(1000);
+               usleep(1000000);
        }
 
        /* When we get to this point we are getting ready to shut down our Citadel server */
        }
 
        /* When we get to this point we are getting ready to shut down our Citadel server */
@@ -214,7 +214,7 @@ void go_threading(void)
                ShutDownEventQueues();
        }
        while (!EVQShutDown)
                ShutDownEventQueues();
        }
        while (!EVQShutDown)
-               usleep(1000);
+               usleep(1000000);
 
 
        terminate_all_sessions();               /* close all client sockets */
 
 
        terminate_all_sessions();               /* close all client sockets */
@@ -226,6 +226,6 @@ void go_threading(void)
                syslog(LOG_DEBUG, "Waiting %d seconds for %d worker threads to exit",
                        countdown, num_workers
                );
                syslog(LOG_DEBUG, "Waiting %d seconds for %d worker threads to exit",
                        countdown, num_workers
                );
-               usleep(1000);
+               usleep(1000000);
        }
 }
        }
 }