Function pact_models::file_utils::with_write_lock
source · pub fn with_write_lock<T>(
path: &Path,
file: &mut File,
attempts: u32,
cl: &mut dyn FnMut(&mut File) -> Result<T>
) -> Result<T>
Expand description
Attempts to get a write lock on the file before proceeding with the provided closure. Has an exponential back-off (100, 1000, 10000 ms), and will return an error if unable to get the lock withing the provided number of attempts.