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

Re: [Libevent-users] cancel pending events on bufferevent



23.09.12 20:02, Adrian Chadd ÐÐÐÐÑÐÐ(ÐÐ):
On 23 September 2012 07:50, Vadym S. Khondar <v.khondar@xxxxxxxxxxxxxx> wrote:

(The task is: after certain point need to give up on bufferevent without any
callbacks invoked as they might be called with already freed structs as
cbarg).

The oft-overlooked problem with threaded code is that you can't
guarantee you can cancel something else in another thread.

My code is essentially single-threaded.
However, sometimes it happens that in callback of one bufferevent I decide to stop processing another bufferevent and thus free up tied resources. In this case if something has already happened on abandoned bufferevent and waits till eventloop invokes its callback I would like to skip these invocations somehow.

So sure, if the bufferevent isn't in-flight in another thread, you can
cancel it. But you have to be prepared for the cancellation to fail
because it's already involved in an IO.

As far as I understand this remark is related to multi-threaded usage which is not the case.

Just putting it out there,


Thanks!



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



--
Vadym S. Khondar,
InvisiLabs.com

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