rvm  1.11
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Private Attributes | List of all members
simple_lock Class Reference

A simple locking mechanism. More...

#include <fs.h>

Collaboration diagram for simple_lock:
Collaboration graph

Public Types

typedef pid_t pid_type
 

Public Member Functions

 simple_lock ()
 C'tor. More...
 
 simple_lock (const std::string &a_lockfile)
 C'tor. More...
 
 ~simple_lock ()
 D'tor. More...
 
void clear (void)
 Clear the simple_lock object. More...
 
void lockfile (const std::string &a_lockfile)
 Set the lockfile path. More...
 
const std::string lockfile (void) const
 Get the lockfile path. More...
 
const pid_type locked_by (void) const
 Get the PID of the locking process. More...
 
const bool is_locked (void) const
 Find out whether or not the lock is in place. More...
 
bool lock (void)
 Lock. More...
 
void unlock (void)
 Unlock. More...
 

Private Attributes

std::string m_lockfile
 

Detailed Description

A simple locking mechanism.

Definition at line 343 of file fs.h.

Member Typedef Documentation

typedef pid_t simple_lock::pid_type

Definition at line 345 of file fs.h.

Constructor & Destructor Documentation

simple_lock::simple_lock ( )

C'tor.

Definition at line 1705 of file fs.cc.

References clear().

Here is the call graph for this function:

simple_lock::simple_lock ( const std::string &  a_lockfile)

C'tor.

Definition at line 1711 of file fs.cc.

References clear(), and lockfile().

Here is the call graph for this function:

simple_lock::~simple_lock ( )

D'tor.

Definition at line 1718 of file fs.cc.

References clear().

Here is the call graph for this function:

Member Function Documentation

void simple_lock::clear ( void  )

Clear the simple_lock object.

Definition at line 1724 of file fs.cc.

References is_locked(), locked_by(), m_lockfile, and unlock().

Referenced by vault_manager::clear(), lock(), lockfile(), vault_manager::select(), simple_lock(), and ~simple_lock().

Here is the call graph for this function:

const bool simple_lock::is_locked ( void  ) const

Find out whether or not the lock is in place.

Definition at line 1765 of file fs.cc.

References locked_by(), and pid().

Referenced by clear(), lock(), vault_manager::select(), and test_simple_lock().

Here is the call graph for this function:

bool simple_lock::lock ( void  )

Lock.

Definition at line 1778 of file fs.cc.

References clear(), is_locked(), m_lockfile, and pid().

Referenced by vault_manager::select(), and test_simple_lock().

Here is the call graph for this function:

const simple_lock::pid_type simple_lock::locked_by ( void  ) const

Get the PID of the locking process.

Definition at line 1746 of file fs.cc.

References exists(), m_lockfile, and pid().

Referenced by clear(), is_locked(), vault_manager::select(), and test_simple_lock().

Here is the call graph for this function:

void simple_lock::lockfile ( const std::string &  a_lockfile)

Set the lockfile path.

Definition at line 1733 of file fs.cc.

References clear(), and m_lockfile.

Referenced by vault_manager::select(), and test_simple_lock().

Here is the call graph for this function:

const std::string simple_lock::lockfile ( void  ) const

Get the lockfile path.

Definition at line 1740 of file fs.cc.

References m_lockfile.

Referenced by simple_lock().

void simple_lock::unlock ( void  )

Unlock.

Definition at line 1798 of file fs.cc.

References exists(), m_lockfile, rm_file(), TRY, and TRY_nomem.

Referenced by clear(), and test_simple_lock().

Here is the call graph for this function:

Member Data Documentation

std::string simple_lock::m_lockfile
private

Definition at line 361 of file fs.h.

Referenced by clear(), lock(), locked_by(), lockfile(), and unlock().


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