Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

more::io::lock_file Struct Reference

A handle to a lock file. More...

#include <lock_file.h>

Inheritance diagram for more::io::lock_file:

Inheritance graph
[legend]
Collaboration diagram for more::io::lock_file:

Collaboration graph
[legend]
List of all members.

Public Methods


Detailed Description

A handle to a lock file.

Read-only locks are not NFS safe (TODO). A workaround is to use access_rw also when only read access is needed.


Constructor & Destructor Documentation

more::io::lock_file::lock_file   [inline]
 

Construct an undefined lock file handle.

more::io::lock_file::lock_file std::string    path [inline, explicit]
 

Construct a handle for a named lock file, but do not create the file yet.

more::io::lock_file::~lock_file   [inline]
 

Calls unlock().

more::io::lock_file::lock_file std::string    path,
bool    blocking
[inline]
 

\depreciated Use another constructor.

Construct a handle and create the lock file with the given name if possible. If blocking=true it will hang until it manages to create the lock.


Member Function Documentation

access_t more::io::lock_file::access   const [inline]
 

Return the current access of the lock.

bool more::io::lock_file::adjust access_t    access
 

Try to obtain the lock without blocking, and return true if successful.

The valid arguments for access are access_none, which causes an unlock, access_r which gives read access, and access_rw which gives read write access. In addition access_w will be changed to access_rw.

bool more::io::lock_file::aquire access_t    access,
infinite_tag   ,
double    dt = 1.0
 

Attempt every dt seconds indefinitely to aquire(access).

See adjust(access_t) for constraint on access.

bool more::io::lock_file::aquire access_t    access,
double    t,
double    dt = 1.0
 

Attempt every dt seconds for t seconds to aquire(access).

Return true if the lock was obtained. See adjust(access_t) for constraint on access.

bool more::io::lock_file::aquire access_t    acc [inline]
 

Return adjust(acc | access()).

bool more::io::lock_file::have_lock   const [inline]
 

\depreciated Use access().

Returns true after successful locking and before unlock().

void more::io::lock_file::lock std::string    path,
bool    blocking
 

\depreciated Establish the lock with the given file name.

void more::io::lock_file::release access_t    access = access_rw
 

Release all access.

This function should ideally neither hang nor fail. In the case of read-only locks, however, it may in exceptional cases hang for a few seconds, and possibly fail. This may be the case if another program was interrupted at the critical stage while adjusting its own read-only lock, or if the lock files were tampered with.

void more::io::lock_file::set_file_name std::string   
 

Set or change the file name of the lock.

This causes an unlock.

void more::io::lock_file::swap lock_file &    lk [inline]
 

Swap two locks.

void more::io::lock_file::unlock   [inline]
 

\depreciated Same ass release().


The documentation for this struct was generated from the following file:
Generated on Sat Sep 7 19:12:43 2002 for more with Doxygen 1.2.13.1. Doxygen 1.2.13.1 is written and copyright 1997-2002 by Dimitri van Heesch.