mirror of
https://github.com/curl/curl.git
synced 2025-02-23 15:10:03 +08:00
mr Hartroth correctly pointed out that poll() isn't really that portable
so we need to hack around it when not there
This commit is contained in:
parent
6a3e2272e9
commit
086daf913c
@ -31,3 +31,7 @@
|
|||||||
|
|
||||||
/* Define if you have the `setvbuf' function. */
|
/* Define if you have the `setvbuf' function. */
|
||||||
#undef HAVE_SETVBUF
|
#undef HAVE_SETVBUF
|
||||||
|
|
||||||
|
/* Define if you have the `poll' function. */
|
||||||
|
#undef HAVE_POLL
|
||||||
|
|
||||||
|
18
src/main.c
18
src/main.c
@ -1878,8 +1878,26 @@ static int parseconfig(const char *filename,
|
|||||||
|
|
||||||
static void go_sleep(long ms)
|
static void go_sleep(long ms)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_POLL
|
||||||
/* portable subsecond "sleep" */
|
/* portable subsecond "sleep" */
|
||||||
poll((void *)0, 0, ms);
|
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 {
|
struct OutStruct {
|
||||||
|
Loading…
Reference in New Issue
Block a user