[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] bufferevent_base_set and threads
So, not possible for bufferevent_openssl_socket_new()?
- scott
> On Aug 8, 2019, at 12:51 AM, Azat Khuzhin <azat@xxxxxxxxxxxx> wrote:
>
> On Tue, Aug 6, 2019 at 2:41 AM Scott Dorr <j.scott.dorr@xxxxxxxxx> 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 majordomo@xxxxxxxxxxxxx with
> unsubscribe libevent-users in the body.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.