Function Reactor.enterCriticalSection

enter a no-fiber switch piece of code.

void enterCriticalSection () nothrow @nogc @safe;

If the code tries to switch away from the current fiber before leaveCriticalSection is called, the reactor will throw an assert. This helps writing code that does interruption sensitive tasks without locks and making sure future changes don't break it.

Critical sections are nestable.

Also see criticalSection below.