aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkotoriのねこ <2567702743@qq.com>2020-06-01 10:51:34 -0700
committerDaniel Stenberg <daniel@haxx.se>2020-06-02 00:11:38 +0200
commit066b30323182193bd034cf86af03d3713c2004ec (patch)
treedf2c296c58f21ca0fc20e3cc070e42109e1b51cc
parent21ed48e8d99b8c172ba0a5871bdd8a22ba43612c (diff)
examples/ephiperfifo: turn off interval when setting timerfd
Reported-by: therealhirudo on github Fixes #5485 Closes #5497
-rw-r--r--docs/examples/ephiperfifo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/examples/ephiperfifo.c b/docs/examples/ephiperfifo.c
index c076a8523..4985678ed 100644
--- a/docs/examples/ephiperfifo.c
+++ b/docs/examples/ephiperfifo.c
@@ -146,7 +146,7 @@ static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
fprintf(MSG_OUT, "multi_timer_cb: Setting timeout to %ld ms\n", timeout_ms);
if(timeout_ms > 0) {
- its.it_interval.tv_sec = 1;
+ its.it_interval.tv_sec = 0;
its.it_interval.tv_nsec = 0;
its.it_value.tv_sec = timeout_ms / 1000;
its.it_value.tv_nsec = (timeout_ms % 1000) * 1000 * 1000;
@@ -155,7 +155,7 @@ static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
/* libcurl wants us to timeout now, however setting both fields of
* new_value.it_value to zero disarms the timer. The closest we can
* do is to schedule the timer to fire in 1 ns. */
- its.it_interval.tv_sec = 1;
+ its.it_interval.tv_sec = 0;
its.it_interval.tv_nsec = 0;
its.it_value.tv_sec = 0;
its.it_value.tv_nsec = 1;
@@ -488,7 +488,7 @@ int main(int argc, char **argv)
}
memset(&its, 0, sizeof(struct itimerspec));
- its.it_interval.tv_sec = 1;
+ its.it_interval.tv_sec = 0;
its.it_value.tv_sec = 1;
timerfd_settime(g.tfd, 0, &its, NULL);