[][src]Function actix_interop::critical_section

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

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).