File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1515
1616#pragma once
1717
18+ #include < assert.h>
19+
1820class DoutPrefixProvider ;
1921
2022// / indicates whether the current thread is in boost::asio::io_context::run(),
@@ -24,3 +26,14 @@ extern thread_local bool is_asio_thread;
2426// / call when an operation will block the calling thread due to an empty
2527// / optional_yield. a warning is logged when is_asio_thread is true
2628void maybe_warn_about_blocking (const DoutPrefixProvider* dpp);
29+
30+ // / enables warnings while in scope. these scopes must not be nested
31+ struct warn_about_blocking_in_scope {
32+ warn_about_blocking_in_scope () {
33+ assert (!is_asio_thread);
34+ is_asio_thread = true ;
35+ }
36+ ~warn_about_blocking_in_scope () {
37+ is_asio_thread = false ;
38+ }
39+ };
You can’t perform that action at this time.
0 commit comments