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

Re: [Libevent-users] Question about internal event mechanism



On Wed, Sep 7, 2011 at 10:54 AM, Mark Ellzey <mthomas@xxxxxxxxxx> wrote:
> On Wed, Sep 07, 2011 at 10:22:15PM +1000, Jim Tink wrote:
>> Could someone provide a small overview on how libevent supports these? IE Is
>> it based on the operating system or context of when an event is created or
>> something like that? Is it something that I would control as a developer
>> etc?
>
> The support is created at the time of compile. If the system supports
> both epoll and select, those are available to your application.
>
> Abstractions have been created around all the supported backends so that
> they are all interchangeable; this is done via a vtable like structure
> "struct eventop" found in event-internal.h
>
> Look at one of the backend specific files (epoll.c, select.c) to see
> how they are used - that's definitely the best way to understand it.
>
> The only "control" you have over things is what backend event mechanism
> to use, which is documented.

Right.  To be specific, have a look at the event_config_* functions in
event2/event.h in Libevent 2.0.  Not every OS supports every backend;
there is a programmatic interface to see which backends exist, and to
disable or select backends by name or by features.

In earlier versions, the only way to set which backend is used was to
disable them with environment variables.  This still works, and it's
great for testing, but it's no longer the preferred way to do it from
within a program.

cheers,
-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.