- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# sbuild::device_lock Class Reference

Device lock. More...

`#include <sbuild-lock.h>`

Inheritance diagram for sbuild::device_lock:

[legend]
Collaboration diagram for sbuild::device_lock:

[legend]
List of all members.

## Public Member Functions
| device_lock (std::string const &device)
| The constructor.
virtual | ~device_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
std::string | device
| The device to lock.

## Detailed Description

Device lock.

Set an advisory lock on a device. The lock is acquired using liblockdev lock_dev(). Note that a lock_type of LOCK_SHARED is equivalent to LOCK_EXCLUSIVE, because this lock type does not support shared locks.

## Constructor & Destructor Documentation

device_lock::device_lock | ( | std::string const & | device | ) |

The constructor.

Parameters:

  | device | the device to lock (full pathname).

device_lock::~device_lock | ( |  | ) | `[virtual]`

The destructor.

## Member Function Documentation

void device_lock::set_lock | ( | lock::type | lock_type,
|  | unsigned int | timeout |
| ) |  |  | `[virtual]`

Acquire a lock.

Parameters:

  | lock_type | the type of lock to acquire.
  | timeout | the time in seconds to wait on the lock.

Implements sbuild::lock.

void device_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.

## Member Data Documentation

std::string sbuild::device_lock::device`[private]`

The device to lock.

The documentation for this class was generated from the following files:

- sbuild/sbuild-lock.h
- sbuild/sbuild-lock.cc