Re: Synchronous signal delivery..

Jamie Lokier
2003-02-15T01:56:42Z

Davide Libenzi wrote:
> > Then again, it is also extremely common to write this:
> >
> > gettimeofday(...)
> > // calculate time until next application timer expires.
> > // Note also race condition here, if we're preempted.
> > read_events(..., next_app_time - timeofday)
> > // we need to know the current time.
> > gettimeofday(...)
> >
> > So perhaps the current select/poll/epoll timeout method is not
> > particularly optimal as it is?
>
> What's bad in epoll_wait() to get events from all pollable descriptors ?

Nothing wrong with that. It's the "relative to now" timeout argument
that is a bit racy, and the fact that you need a gettimeofday() system
call just before - every time - _purely_ to calculate the time until
the next application timer event.

If you must have a separate system call every time round your event
loop, it may as well set up a timerfd and let that be another pollable
descriptor.

In which case, read() is just fine for getting events :)

-- Jamie