Re: [Libevent-users] multi-threaded question

2018-02-24 Thread Azat Khuzhin
On Thu, Feb 22, 2018 at 7:29 PM, Scott Dorr  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 majord...@freehaven.net with
unsubscribe libevent-usersin the body.


[Libevent-users] multi-threaded question

2018-02-22 Thread Scott Dorr
Thread A generates a timer event.
Thread B calls event_free_finalize() on that event.

Is this ok?


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.
Thread B goes back to polling its queue.

Thread A wakes up.


The timer firing had been put in A’s queue, B later event_free_finalize()’d it 
… will A’s callback still be invoked for that timer?


- psd

***
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-usersin the body.