From e4d4c828d96aa1d89660e3a28d0aed4278ec5abe Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Wed, 4 Aug 2004 20:51:57 +0000 Subject: [PATCH] nanosleep patch. --- FIX | 3 ++- TODO | 1 + src/timeout.c | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/FIX b/FIX index 2ffe9e7..15eb4a9 100644 --- a/FIX +++ b/FIX @@ -1 +1,2 @@ -filter.chain is coroutine-free +gettime returns time since Unix Epoch 1/1/1970 (UTC) +sleep is robust to interrupts diff --git a/TODO b/TODO index b94e1b9..2b43d3c 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ +fix manual for gettime and sleep use wim's filter.chain use mike's "don't set to blocking before closing unless needed" patch? take a look at DB's smtp patch (add "extra argument" table) diff --git a/src/timeout.c b/src/timeout.c index 152af29..7d55031 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -199,7 +199,10 @@ int tm_lua_sleep(lua_State *L) n -= t.tv_sec; t.tv_nsec = (int) (n * 1000000000); if (t.tv_nsec >= 1000000000) t.tv_nsec = 999999999; - nanosleep(&t, &r); + while (nanosleep(&t, &r) != 0) { + t.tv_sec = r.tv_sec; + t.tv_nsec = r.tv_nsec; + } #endif return 0; }