简体   繁体   English

在升压计时器上阻塞 wait()

[英]blocking wait() on boost timer

The documentation says : 文档说

This function is used to wait for the timer to expire.这个 function 用于等待定时器到期。 This function blocks and does not return until the timer has expired.这个 function 阻塞并且在计时器到期之前不会返回。

Does this block the whole I/O processing similar to a sleep or does the asynchronous I/O still work?这会阻塞整个 I/O 处理类似于睡眠还是异步 I/O 仍然有效? In other words: If I have asynchronous I/O or other timers running on the same io_service, do they block until the wait is over, or do they get called while the process is wait ing?换句话说:如果我在同一个 io_service 上运行异步 I/O 或其他计时器,它们是阻塞直到wait结束,还是在进程wait时被调用?

The thread that you call wait on will be blocked but if you have other threads they should continue executing.您调用wait的线程将被阻塞,但如果您有其他线程,它们应该继续执行。

Note that if you are using strands then if you call wait from within a strand no other executors will run for that strand even if other threads are available.请注意,如果您使用的是 strands,那么如果您从一个 strand 中调用wait ,即使其他线程可用,也不会为该 strand 运行其他执行程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM