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

[Libevent-users] Callback after all events from the current batch have been cleared



I'm looking at a bug which appears to come down to: some of my event callbacks deallocate events, bufferevents, and/or their callback data. Under difficult-to-reproduce circumstances, libevent appears to queue up calls to my callbacks (possibly implicitly via internal control flow), and call them even though the associated events and data have been deallocated. I wish to apply a large hammer to this problem: delay deallocations until after all queued-up callbacks have been processed, but before libevent asks the OS for the next batch of events.

I *think* this can be done with a timer event which is assigned a lower priority than all other events in the program, and which is event_add()ed with an immediate timeout whenever there are deallocations pending.

Will this work?

Is there a better way to do this?

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