-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
examples: ephiperfifo: weird timerfd_settime call #3632
Comments
My immediate impression is that there's a missing Zero-init of |
I see that just below you actually test the value of |
Yeah it looks fishy. I think you might be right. I think it might be leftovers of some code that was moved into the else block. I feel like the timer should be disarmed in the |
I seem to recall having to iterate on this function a few times. I think there was some trickiness in here where I didn't fully understand the semantics of
I think it's a little ambiguous what to do in a Anyhow, I think that yes, line 156 should be removed. |
In the /* Update the timer after curl_multi library does it's thing. Curl will
* inform us through this callback what it wants the new timeout to be,
* after it does some work. */
static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
{
struct itimerspec its;
CURLMcode rc;
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_nsec = 0;
its.it_value.tv_sec = timeout_ms / 1000;
its.it_value.tv_nsec = (timeout_ms % 1000) * 1000;
timerfd_settime(g->tfd, /*flags=*/0, &its, NULL);
}
else {
memset(&its, 0, sizeof(struct itimerspec));
timerfd_settime(g->tfd, /*flags=*/0, &its, NULL);
}
return 0;
} |
Actually you need a special case here, because from One possible way is to to set On the other hand, https://github.com/libevent/libevent/blob/master/epoll.c#L434-L438 |
curl/docs/examples/ephiperfifo.c
Lines 149 to 156 in 64d598d
It looks to me like
its
is not initialized at this point. I would even say that this line is here by mistake?@cheshirekow should know in a glance!
The text was updated successfully, but these errors were encountered: