utopia9527 commented on issue #2736:
URL: https://github.com/apache/brpc/issues/2736#issuecomment-2287717312

   > > enqueue 返回 std::future ,外部在这个 future 上 wait 会阻塞线程。 你可能需要单独写个适配 bthread 的 
future,而不是直接使用标准库的 future。
   > 
   > 
std::future::get会阻塞worker线程,当std::future::get的并发数大于worker数,就会阻塞全部worker线程了,这时候没法调度其他bthread了。除非在其他独立线程上std::promise::set_value,但是这样只是不会”卡死“,长尾可能已经导致服务不可用了。
   > 
   > 
可以用baidu最近开源的[babylon](https://github.com/baidu/babylon),有支持bthread的[future](https://github.com/baidu/babylon/blob/main/docs/future.md)。
   
   有个小问题, 线程池里面如果使用std:mutex的话不会出现这种现象。  是说可能加mutex锁的时候让当前worker的其它bthread 
被"偷过去"了么


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to