You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typedefstructACL_FIBER_ASYNCACL_FIBER_ASYNC;
FIBER_APIACL_FIBER_ASYNC*acl_fiber_async_create(intmax_queue);
FIBER_APIintacl_fiber_async_post(ACL_FIBER_ASYNC*async, void*data); // can be use in other threadFIBER_APIintacl_fiber_async_wait(ACL_FIBER_ASYNC*async, void**data, inttimeout);
FIBER_APIintacl_fiber_async_free(ACL_FIBER_ASYNC*async);
Activity
zhengshuxin commentedon May 6, 2022
你所说的这个功能在 acl::fiber_tbox 类里已经实现,该类是基于 C 代码中的 acl_fiber_event_xxx 系列操作,在 acl_fiber_event_wait() 时一旦发生等待,则针对不同平台采用不同的方法:
1、Linux:eventfd(),这个仅占用一个句柄;
2、MacOS:socketpair,占用两个句柄;
3、Windows:用 TCP socket 模拟的 socketpair,因为在windows存在 iocp 引擎及界面消息引擎,所以使用 tcp socket 更通用些;如果有人提供windows下的优化版本,则不胜感激。
另外,我曾经想将等待时所用的事件句柄合并成一个放在主循环里来实现,后来没时间弄这块,也许将来可以继续优化。