Use timevals everywhere where it is possible, including API between main

loop and event dispatchers. This simplifies code and eliminates a bug,
when kevent dispatcher is called with 0 timeout.

While here, in the main loop call gettimeofday() right after event
dispatcher returns. Otherwise, we are using outdated "timeofday" in
second part of the loop. I don't know any bugs because of that, but
they are possible.
This commit is contained in:
Gleb Smirnoff
2019-05-08 14:19:46 -07:00
parent cad8c922f0
commit 1d363c209f
4 changed files with 31 additions and 47 deletions

View File

@@ -42,7 +42,7 @@ typedef int event_module_add_t(struct event *);
typedef int event_module_del_t(struct event *, int flags);
typedef int event_module_init_t(void);
typedef void event_module_fini_t(void);
typedef int event_module_process_t(u_long);
typedef int event_module_process_t(struct timeval *);
struct event_module {
event_module_add_t *add;
event_module_del_t *del;