sbuild::file_lock Class Reference

File lock. More...

#include <sbuild-lock.h>

Inheritance diagram for sbuild::file_lock:

Inheritance graph
[legend]
Collaboration diagram for sbuild::file_lock:

Collaboration graph
[legend]

List of all members.

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?


Detailed Description

File lock.

Simple whole-file shared and exclusive advisory locking based upon POSIX fcntl byte region locks.


Constructor & Destructor Documentation

file_lock::file_lock ( int  fd  ) 

The constructor.

Parameters:
fd the file descriptor to lock.

file_lock::~file_lock (  )  [virtual]


Member Function Documentation

void file_lock::set_lock ( lock::type  lock_type,
unsigned int  timeout 
) [virtual]

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().


Member Data Documentation

int sbuild::file_lock::fd [private]

The file descriptor to lock.

Referenced by set_lock(), and ~file_lock().

bool sbuild::file_lock::locked [private]

Is the file locked?

Referenced by set_lock(), and ~file_lock().


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

Generated on Sun Mar 22 22:18:22 2009 for sbuild by  doxygen 1.5.8