Struct fd_lock::FdLock [−][src]
pub struct FdLock<T: AsRawFd> { /* fields omitted */ }
Expand description
A file descriptor lock.
Implementations
Acquires a new lock, blocking the current thread until it’s able to do so.
This function will block the local thread until it is available to acquire the lock. Upon returning, the thread is the only thread with the lock held. An RAII guard is returned to allow scoped unlock of the lock. When the guard goes out of scope, the lock will be unlocked.
Errors
On Unix this may return an error if the operation was interrupted by a signal handler.
Attempts to acquire an advisory lock.
Unlike FdLock::lock
this function will never block, but instead will
return an error if the lock cannot be acquired.
Errors
If the lock is already held and ErrorKind::WouldBlock
error is
returned. This may also return an error if the operation was interrupted
by a signal handler.