include "event2/thread.h"

libevent 多线程发送数据 bufferevent_write
update:2021-10-14
需要增加:

ifdef WIN32

evthread_use_windows_threads();

else

evthread_use_pthreads();

endif

evthread_make_base_notifiable(base);
struct bufferevent*bev = bufferevent_socket_new(base, -1,
    BEV_OPT_CLOSE_ON_FREE | BEV_OPT_THREADSAFE );

增加 BEV_OPT_THREADSAFE 可能会更 可靠。

本文链接地址:https://const.net.cn/505.html

标签: none

添加新评论