[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] epoll_wait-like timeout with libevent (tick generation)



Portability issues aside, is there a way to ask event_base_* functions
to enforce epoll_wait()-like timeout ?

I need to have an ability to generate "ticks" - say once every 100
msec or thereabouts and run some callbacks whenever ticks occur.

I understand libevent offers its own way to generate these, but is
there a way to ask libevent to pass the TO value to epoll_wait ?

The legacy code I have, does something like this (pseudo):


##################################################################

add FDs of interest to the epoll_fd

epoll_wait (...., 100 );  // Wait for events, but no longer than for 100 msec

if (IO events reported)
  process events;

if (time_now > time_prev_run + 100)
  // more than 100 ms passed since the last run,
 time_prev_rum = time_now
 run_100ms_tick_logic()
...

###################################################################

Note that I dont need exactly 100 msec between the runs, anything
close enough is good enough.
The logic that runs in tick processing is different from IO timeout
enforcement (which libevent supports,
separately, too).
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.