Struct file_guard::FileGuard [−][src]
Expand description
An RAII implementation of a “scoped lock” of a file. When this structure is dropped (falls out of scope), the lock will be unlocked.
This structure is created by the lock(), try_lock(), and
lock_any() functions.
Implementations
Safely exchanges an Exclusive Lock for a Shared one.
If the currently held lock is already Shared, no change is made and
the method succeeds. This exchange safely ensures no lock is released
during operation. That is, no waiting Exclusive lock attempts may
obtain the lock during the downgrade. Other Shared locks waiting
will be granted a lock as a result, however.
