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

[Libevent-users] event_active bug?



Hi,

I had some problems using event_active() function, and as I'm not sure weather it's a bug or not I've decided to write about it.

I'm using two event bases, sender_base and feeder_base. sender_base runs as a main program loop using event_dispatch(). If there is nothing to send it calls event_base_loop() on feeder_base which fills the buffer (with events reading from files which(events) are all the time active).
So in feeder_base there are many all the time pending events and there are invoked one by one when event_base_loop() is called.

It worked perfectly fine unless I've decided to add to the feeder_base event which invokes itself by event_active and not by file descriptor + EV_READ. This event was filling the buffer and then rescheduling itself calling event_active(). I've expected that after calling event_active event will be just scheduled as pending and invoked during next call of event_base_loop(). But from this time it was invoking itself infinitely within one loop of feeder_base. I was able to override this problem by opening random file (like /dev/zero) and invoking this event based on EV_READ and not by event_active. Anyway I'm just not sure if event_active is supposed to work like this or it's kind of a bug, so I've decided to write about it.

I know my architecture is a bit messy, but I hope my description is clear enough.

Thanks for any help
Harnen