我想在我的代码中添加一个运行时断言,用于检查代码是否由给定的链保护。
这是一个伪示例:
...
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);