-
Notifications
You must be signed in to change notification settings - Fork 931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fiber: add async feature for multithreading #277
Comments
你所说的这个功能在 acl::fiber_tbox 类里已经实现,该类是基于 C 代码中的 acl_fiber_event_xxx 系列操作,在 acl_fiber_event_wait() 时一旦发生等待,则针对不同平台采用不同的方法: 另外,我曾经想将等待时所用的事件句柄合并成一个放在主循环里来实现,后来没时间弄这块,也许将来可以继续优化。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
功能需求
在任意一个线程(包括fiber所在线程)可以向任意EVENT投递一个void*
被投递的EVENT有fiber在等待数据, 同时支持超时机制
最好做到. 有序投递, 有序处理 (不考虑多线程并发投递, 1:1)
投递之后可以有一个队列暂存, 若队列满了可以考虑丢弃 (并输出日志)
接口示意
详细描述
目前的多线程通讯是基于socket, 实现方式比较通用, 但个人感觉有些过重了, 也会增加listen socket
最好是利用OS提供的进程内IPC机制
查阅资料和参考libuv之后的实现思路:
而select和kqueue不了解, 或许可以先用socket pair?
也考虑过匿名pipe实现, 但细节尚未考虑周全
参考资料
https://man7.org/linux/man-pages/man2/eventfd.2.html
https://docs.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-postmessagea
The text was updated successfully, but these errors were encountered: