diff --git a/ostd/concurrency.hh b/ostd/concurrency.hh index 292bbf0..c6ac79a 100644 --- a/ostd/concurrency.hh +++ b/ostd/concurrency.hh @@ -11,6 +11,7 @@ #include #include #include +#include #include "ostd/platform.hh" #include "ostd/coroutine.hh" @@ -58,6 +59,9 @@ namespace detail { template current_scheduler_owner(S &sched) { + if (current_scheduler) { + throw std::logic_error{"another scheduler already running"}; + } current_scheduler = &sched; }