We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
如果队列为空,while (try read); 是一个会把cpu core吃满的操作,在实际工程中适用范围很小。
此处需要一个std::condition_variable来等待,引入condition又会有新的问题,不是使用者直接引入就能解决的,应该还是需要wait-free队列处理好这个事情。
The text was updated successfully, but these errors were encountered:
不一定要占满cpu忙等,可以做其他事或yield让出cpu
Sorry, something went wrong.
yield的效果也是不如cond好,虽然避免了单个cpu吃满的情况,但是yield的线程多了,对系统的负担也是挺重的,是一种无谓的浪费
也不一定要cond,但至少要让用户可以嵌入一个通知机制。 比如要传递数据给epoll网络线程时,就要能把处于epoll_wait状态的线程唤醒起来做事情
@yyzybb537 如果队列为空,协程释放占用CPU, 如果用cond的话 一般怎么使用, 有示例的一些代码吗?
如果使用yield, 这个可以切换到当前线程的其他协程处理么?
No branches or pull requests
如果队列为空,while (try read); 是一个会把cpu core吃满的操作,在实际工程中适用范围很小。
此处需要一个std::condition_variable来等待,引入condition又会有新的问题,不是使用者直接引入就能解决的,应该还是需要wait-free队列处理好这个事情。
The text was updated successfully, but these errors were encountered: