diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index 998b1f3e4..a7533a00f 100644 --- a/src/main.c +++ b/src/main.c @@ -1878,8 +1878,26 @@ static int parseconfig(const char *filename, static void go_sleep(long ms) { +#ifdef HAVE_POLL /* portable subsecond "sleep" */ poll((void *)0, 0, ms); +#else + /* systems without poll() need other solutions */ + +#ifdef WIN32 + /* Windows offers a millisecond sleep */ + Sleep(ms); +#else + /* Other systems must use select() for this */ + struct timeval timeout; + + timeout.tv_sec = 0; + timeout.tv_usec = ms * 1000; + + select(0, NULL, NULL, NULL, &timeout); +#endif + +#endif } struct OutStruct { |