Skip to main content

atomically

Function atomically 

Source
pub fn atomically<T>(f: impl FnOnce() -> T) -> T
Expand description

Executes the given function as an atomic operation.

On panic the region is left open and the worker recovers + re-executes the block. Use atomically_result when the body returns a Result so that error returns also force a trap rather than silently committing the region.