Skip to content
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

请问handy库为什么要用管道来唤醒I/O线程? #35

Closed
onlyet opened this issue Apr 28, 2018 · 1 comment
Closed

请问handy库为什么要用管道来唤醒I/O线程? #35

onlyet opened this issue Apr 28, 2018 · 1 comment

Comments

@onlyet
Copy link

onlyet commented Apr 28, 2018

正在学习您的handy库,不明白为什么要用管道来唤醒I/O线程,任务队列不是有条件信号吗,条件等待的时候线程挂起就不占用资源了吧?所以我就是没明白用管道唤醒然后去条件等待的目的

@dtm-labs
Copy link
Contributor

dtm-labs commented May 1, 2018

IO线程如果挂起,那么就不处理IO了,就会导致全部连接都没有响应。
使用管道,会统一走入epoll,然后非阻塞式的取获取任务,这样能够保证IO线程值会在所有IO操作都处理完的情况下才挂起,并且有任何IO到来的时候,会被唤起

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant