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

WvLockFile Class Reference

#include <wvlockfile.h>

Collaboration diagram for WvLockFile:

[legend]
List of all members.

Public Member Functions

 WvLockFile (WvStringParm _lockname)
bool isok ()
 Check to make sure no lock is established or that it's owned by us.

bool lock ()
 Creates the lockfile with the current pid.

bool unlock ()
 Removes the lockfile if present.

pid_t readpid ()
 Returns one of three things: -1 if the lockfile exists, but is inaccessible.


Protected Attributes

WvString lockname

Constructor & Destructor Documentation

WvLockFile::WvLockFile WvStringParm  _lockname  ) 
 

Definition at line 13 of file wvlockfile.cc.

References WvLockFile(), and WvStringParm.

Referenced by WvLockFile().


Member Function Documentation

bool WvLockFile::isok  ) 
 

Check to make sure no lock is established or that it's owned by us.

Definition at line 20 of file wvlockfile.cc.

References readpid().

Referenced by lock(), and unlock().

bool WvLockFile::lock  ) 
 

Creates the lockfile with the current pid.

Returns success/failure.

Definition at line 27 of file wvlockfile.cc.

References WvFDStream::isok(), isok(), lockname, and WvStream::print().

Referenced by readpid().

int WvLockFile::readpid  ) 
 

Returns one of three things: -1 if the lockfile exists, but is inaccessible.

0 if there is no lockfile, or the process is not running. >0 The pid of the known-running process that owns the lock.

Definition at line 52 of file wvlockfile.cc.

References getdirname(), WvStream::getline(), lock(), and lockname.

Referenced by isok(), and unlock().

bool WvLockFile::unlock  ) 
 

Removes the lockfile if present.

If there's no lockfile after, returns true, otherwise false.

Definition at line 41 of file wvlockfile.cc.

References isok(), lockname, and readpid().


Member Data Documentation

WvString WvLockFile::lockname [protected]
 

Definition at line 40 of file wvlockfile.h.

Referenced by lock(), readpid(), and unlock().


The documentation for this class was generated from the following files:
Generated on Tue Oct 5 01:09:28 2004 for WvStreams by doxygen 1.3.7