/
Common optimization for timers with event loops
Common optimization for timers with event loops
I discuss a common optimization with timer functionality in event loops implementations.
For a concrete example to reference in the above discussion have a look at kqueue which is part of FreeBSD (the core of Mac OS X):
int kevent(int kq, const struct kevent *changelist, int nchanges,
struct kevent *eventlist, int nevents,
const struct timespec *timeout);
Notice how it takes a timeout argument? The same is true for the Berkley sockets select call:
int select(int nfds, fd_set *restrict readfds,
fd_set *restrict writefds, fd_set *restrict exceptfds,
struct timeval *restrict timeout);
Different implementation with the same core underlying need. Make sense?
, multiple selections available,
Related content
How do we solve synchronization issues with the network neuron implementation
How do we solve synchronization issues with the network neuron implementation
Read with this
Implementing a event loop - how do you handle timers?
Implementing a event loop - how do you handle timers?
More like this
Busy mental cycles analogy
Busy mental cycles analogy
Read with this
Event Loop
Event Loop
More like this
Watching boring movies
Watching boring movies
Read with this
The socket C10K problem
The socket C10K problem
More like this