On Tue, Aug 6, 2019 at 2:41 AM Scott Dorr <[email protected]> wrote:
>
> ThreadA receives a new connection and creates a new bufferevent to handle the 
> IO. Sometime later, it needs to hand responsibility for that connection off 
> to another thread.
>
> Can ThreadA use something like bufferevent_base_set to ‘move’ that 
> bufferevent to the other thread (ThreadB) so that callbacks associated with 
> it are triggered in ThreadB’s context?

bufferevent_base_set() will work but with a few caveats:
- will *work* only for plain bufferevent sock (created with
bufferevent_socket_new())
- will *fail* if you already enables some events (EV_READ/...), hence
you need to buffevent_disable/bufferevent_base_set/bufferevent_enable
sequence

Regards,
Azat.
***********************************************************************
To unsubscribe, send an e-mail to [email protected] with
unsubscribe libevent-users    in the body.

Reply via email to