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

Re: [Libevent-users] multi-threaded question



On Thu, Feb 22, 2018 at 7:29 PM, Scott Dorr <j.scott.dorr@xxxxxxxxx> wrote:
> Thread A generates a timer event.
> Thread B calls event_free_finalize() on that event.
>
> Is this ok?

Yes, but only if you enabled pthread/or-other-threads (win32) support,
for example for pthreads you can do this with:
  evthread_use_pthreads()

>
>
> What if:
>
> Thread A and B each have their own bases.
>
> Thread A generates timer event.
>
> Thread B is invoked through some read event.
>         While Thread B is in scope, timer ‘goes off’ and is queued for A to process when we get back to A’s event queue
> Still in Thread B, it calls event_free_finalize() on that event.

Once event_free_finalize() returns, none of callbacks for this event
should be fired.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.