[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] epoll_wait-like timeout with libevent (tick generation)
- To: libevent-users@xxxxxxxxxxxxx
- Subject: [Libevent-users] epoll_wait-like timeout with libevent (tick generation)
- From: Programmist Setevik <programmist.setevik@xxxxxxxxx>
- Date: Tue, 16 Oct 2012 07:35:25 -0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Tue, 16 Oct 2012 07:35:31 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=sYgqLq1FW8lpYDqGyjoTWRZ+5hUy+2gRrCGbfKhzqCo=; b=oYvaarmZCq41M96TFlwXsNQK+e56PkFE0O8jqcE7Yg9uTkJvpzbPYdVcgvXdU1s10a khtgyF/9IMP/VRD4ICJ7I4F2EbQAU+1dZX9d5TswKfaBoZUEl9U6Ekj93u2VwpdNw07t UtBU+0IbI5jzDvTW4FutB7A92X4MqTFliKlS0WlSh24+ell7LAq7p5IfiKOlLsvmCKIR tNvipvxTWUJ5GLeGC0C3MrHFr7p+sMf2UmUiYfYS+Eh9foCtXuU4AGTfKn2VM2ECUr0S n/kBRauMheodxFy0YlWuTVTOe+9FzIX8iHNApLB1jZY7k2FBAxnd6TidCyG+Bl0eNrgv BCtw==
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
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.