A simple locking mechanism. More...
#include <fs.h>
Public Types | |
| typedef pid_t | pid_type |
Public Member Functions | |
| simple_lock () | |
| C'tor. | |
| simple_lock (const std::string &a_lockfile) | |
| C'tor. | |
| ~simple_lock () | |
| D'tor. | |
| void | clear (void) |
| Clear the simple_lock object. | |
| void | lockfile (const std::string &a_lockfile) |
| Set the lockfile path. | |
| const std::string | lockfile (void) const |
| Get the lockfile path. | |
| const pid_type | locked_by (void) const |
| Get the PID of the locking process. | |
| const bool | is_locked (void) const |
| Find out whether or not the lock is in place. | |
| bool | lock (void) |
| Lock. | |
| void | unlock (void) |
| Unlock. | |
Private Attributes | |
| std::string | m_lockfile |
A simple locking mechanism.
Definition at line 343 of file fs.h.
| typedef pid_t simple_lock::pid_type |
| simple_lock::simple_lock | ( | ) |
| simple_lock::simple_lock | ( | const std::string & | a_lockfile | ) |
C'tor.
Definition at line 1679 of file fs.cc.
References clear(), and lockfile().

| simple_lock::~simple_lock | ( | ) |
| void simple_lock::clear | ( | void | ) |
Clear the simple_lock object.
Definition at line 1692 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().

| const bool simple_lock::is_locked | ( | void | ) | const |
Find out whether or not the lock is in place.
Definition at line 1733 of file fs.cc.
References locked_by(), and pid().
Referenced by clear(), lock(), vault_manager::select(), and test_simple_lock().

| bool simple_lock::lock | ( | void | ) |
Lock.
Definition at line 1746 of file fs.cc.
References clear(), is_locked(), m_lockfile, and pid().
Referenced by vault_manager::select(), and test_simple_lock().

| const simple_lock::pid_type simple_lock::locked_by | ( | void | ) | const |
Get the PID of the locking process.
Definition at line 1714 of file fs.cc.
References exists(), m_lockfile, and pid().
Referenced by clear(), is_locked(), vault_manager::select(), and test_simple_lock().

| const std::string simple_lock::lockfile | ( | void | ) | const |
Get the lockfile path.
Definition at line 1708 of file fs.cc.
References m_lockfile.
Referenced by simple_lock().
| void simple_lock::lockfile | ( | const std::string & | a_lockfile | ) |
Set the lockfile path.
Definition at line 1701 of file fs.cc.
References clear(), and m_lockfile.
Referenced by vault_manager::select(), and test_simple_lock().

| void simple_lock::unlock | ( | void | ) |
Unlock.
Definition at line 1766 of file fs.cc.
References exists(), m_lockfile, rm_file(), TRY, and TRY_nomem.
Referenced by clear(), and test_simple_lock().

std::string simple_lock::m_lockfile [private] |
Definition at line 361 of file fs.h.
Referenced by clear(), lock(), locked_by(), lockfile(), and unlock().
1.6.1