proc_lock

Attribute Macro proc_lock 

Source
#[proc_lock]
Expand description

Wraps the annotated function with a blocking lock that is released when the function is returned.

⚠ Use with caution - this macro panics on error - See Panics section below.

§Args:

  • name: The name of the lock. Can be any relative / absolute path.
  • absolute: Indicates whether the provided name should be created at the temp_dir or as an absolute path (at the root directory). Default is false.

§Example


#[proc_lock(name = "my_lock.lock", absolute = false)]
fn my_locked_function() {}

§Panics

This macro will panic if the underlying locking function call fails.