diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-08-13 12:12:08 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-08-13 12:12:08 +0000 |
commit | 086daf913cd5022d8cf5e165ae08bf565242dd84 (patch) | |
tree | 9b558f17e67dd88ac36e052fb813375dcf6be0d7 | |
parent | 6a3e2272e98d04ed2bedda5cdaadd884206264b6 (diff) |
mr Hartroth correctly pointed out that poll() isn't really that portable
so we need to hack around it when not there
-rw-r--r-- | src/config.h.in | 4 | ||||
-rw-r--r-- | src/main.c | 18 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/config.h.in b/src/config.h.in index 6ebc04c8a..fdd8f65f7 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -31,3 +31,7 @@ /* Define if you have the `setvbuf' function. */ #undef HAVE_SETVBUF + +/* Define if you have the `poll' function. */ +#undef HAVE_POLL + 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 { |