diff --git a/code/autoupdater/autoupdater.c b/code/autoupdater/autoupdater.c index 4a052027..e013a1f4 100644 --- a/code/autoupdater/autoupdater.c +++ b/code/autoupdater/autoupdater.c @@ -933,10 +933,13 @@ static void waitToApplyUpdates(void) OS forcibly closes the pipe), we will unblock. Then we can loop on kill() until the process is truly gone. */ int x = 0; + struct timespec req; + req.tv_sec = 0; + req.tv_nsec = 100000000; read(3, &x, sizeof (x)); info("Pipe has closed, waiting for process to fully go away now."); while (kill(options.waitforprocess, 0) == 0) { - usleep(100000); + nanosleep(&req, NULL); } #endif } diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c index 66b6fa17..db29e8f0 100644 --- a/code/sys/sys_unix.c +++ b/code/sys/sys_unix.c @@ -38,6 +38,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#include qboolean stdinIsATTY; @@ -548,11 +549,15 @@ void Sys_Sleep( int msec ) } else { + struct timespec req; + // With nothing to select() on, we can't wait indefinitely if( msec < 0 ) msec = 10; - usleep( msec * 1000 ); + req.tv_sec = msec/1000; + req.tv_nsec = (msec%1000)*1000000; + nanosleep(&req, NULL); } }