critical_section

Function critical_section 

Source
pub fn critical_section<A: Actor, F>(f: F) -> impl Future<Output = F::Output>
where A::Context: AsyncContext<A>, F: 'static + Future,
Expand description

May be called in the same places as with_ctx to run a chunk of async code with exclusive access to an actor’s state: no other futures spawned to this actor will be polled during the critical section. Unlike with_ctx, calls to this function may be nested, although there is little point in doing so. Calling with_ctx from within a critical section is allowed (and expected).