#include <sbuild-lock.h>


Public Member Functions | |
| file_lock (int fd) | |
| The constructor. | |
| virtual | ~file_lock () |
| The destructor. | |
| virtual void | set_lock (lock::type lock_type, unsigned int timeout) |
| Acquire a lock. | |
| virtual void | unset_lock () |
| Release a lock. | |
Private Attributes | |
| int | fd |
| The file descriptor to lock. | |
| bool | locked |
| Is the file locked? | |
Simple whole-file shared and exclusive advisory locking based upon POSIX fcntl byte region locks.
| file_lock::file_lock | ( | int | fd | ) |
| file_lock::~file_lock | ( | ) | [virtual] |
The destructor.
References fd, sbuild::lock::LOCK_NONE, locked, sbuild::log_exception_warning(), and sbuild::lock::UNLOCK.
| void file_lock::set_lock | ( | lock::type | lock_type, | |
| unsigned int | timeout | |||
| ) | [virtual] |
Acquire a lock.
Implements sbuild::lock.
References fd, sbuild::lock::LOCK, sbuild::lock::LOCK_EXCLUSIVE, sbuild::lock::LOCK_SHARED, sbuild::lock::LOCK_TIMEOUT, locked, sbuild::lock::set_timer(), sbuild::lock::UNLOCK, sbuild::lock::UNLOCK_TIMEOUT, and sbuild::lock::unset_timer().
Referenced by sbuild::chroot_config::load_data(), sbuild::chroot::setup_session_info(), and unset_lock().
| void file_lock::unset_lock | ( | ) | [virtual] |
Release a lock.
This is equivalent to set_lock with a lock_type of LOCK_NONE and a timeout of 0.
Implements sbuild::lock.
References sbuild::lock::LOCK_NONE, and set_lock().
Referenced by sbuild::chroot_config::load_data(), and sbuild::chroot::setup_session_info().
int sbuild::file_lock::fd [private] |
bool sbuild::file_lock::locked [private] |
1.5.8