[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
- To: libevent-users@xxxxxxxxxxxxx
- Subject: [Libevent-users] Callback after all events from the current batch have been cleared
- From: Zack Weinberg <zackw@xxxxxxxxx>
- Date: Mon, 25 Jun 2012 10:20:26 -0700
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Mon, 25 Jun 2012 13:20:41 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=IIyevNKvSuvF4H0yHRGQJLu8xcVKErOtRTRWVglIdGc=; b=ibc8pWCUgGmPCDAlhw42B+obvBDpkJioIEFAD4dL2Ma+A4DOETVy9FiAIEKaF5W2Xy c+z+A8zyQqrrFpTiiVFW9vyYduaHaEfFWVPjjkLHT2gOuQc+ImPLkkwfjtz3xWKy4Mu+ mvsjRcLpnwuTBUwmDVJpVgJhD/1SjSJLYfo6y/djbLZN+NlBBUVXnbksjFWbhjpTv/tN j9ldz+A6UrF1jUARu39by+XhXVZ8huVPBLa0S4sAH/GlsYJmm5SLGgBuopb4Bz8L+jv7 ybJGlnhQyE6uuicV2uN77XtQSJXZRtbvKdYXnAXAAZd1Nx2Gyds1XWeTgEgUuiC+6kfh ObvQ==
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
- User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20120614 Thunderbird/13.0.1
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.