![](/img/trans.png)
[英]How to detect if handler is an ASIO strand wrap and call it through the strand?
[英]How to runtime-check if code is guarded by given asio::strand instance
我想在我的代码中添加一个运行时断言,以检查代码是否受给定链保护。
这是一个伪示例:
...
asio::io_service my_io_service;
asio::strand my_strand(my_io_service);
...
void my_async_callback(void) {
// ASSERT that check that my_strand is guarding then code
ASSERT(?? my_strand ??)
}
...
// With this call my_async_callback is guarded by strand
my_strand.post(&my_async_callback);
...
// With this call my_async_callback is NOT guarded by strand
io_service.post(&my_async_callback);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.