aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-08-13 12:12:08 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-08-13 12:12:08 +0000
commit086daf913cd5022d8cf5e165ae08bf565242dd84 (patch)
tree9b558f17e67dd88ac36e052fb813375dcf6be0d7 /src/main.c
parent6a3e2272e98d04ed2bedda5cdaadd884206264b6 (diff)
mr Hartroth correctly pointed out that poll() isn't really that portable
so we need to hack around it when not there
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c18
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 {