spinning bug

Anatoly Vorobey mellon@pobox.com
Tue, 26 Aug 2003 06:14:36 +0300

On Mon, Aug 25, 2003 at 07:58:52PM -0700, Brad Fitzpatrick wrote:
> [ moved to mailing list ]
> But, how do we tell libevent we want edge-triggered?  If we do it
> ourselves, how do we get libevent's current mode?
> Should we fork libevent and include it in memcached?  (perfectly legal,
> but questionably immoral)
> - Brad

We could talk to libevent's maintainer about extending libevent
with the ability to to a) find out at runtime which method is used (this 
is useful anyway) and b) set method-specific flags, like 
an edge_triggered flag for the epoll method. The actual coding needed 
for this is simple, the question is only whether the maintainer'll agree 
this is a good thing. I could write the patch for libevent if we get the 
maintainer to go along with it [however, I do think we need to test this 
idea locally first; it's super-easy to just augment libevent's 
epoll_ctl() calls for creation/modification of an event and add an 
EPOLLET flag to them. We could do that, rebuild libevent, rebuild 
memcached statically and test the hell out of it. We've never tried 
edge-triggered epoll before - it's just an idea I had, and for all 
I know there may be gotchas lurking that I'm not seeing right now].

Alternatively, we could abstract our event handling a bit and make it
libevent-independent; detect epoll ourselves and use it if it's 
present, fall back on libevent otherwise. 

Forking libevent is yucky and probably the worst alternative.