AppInstance Class Reference

Application instance management class. More...

#include <appinst.h>

List of all members.

Public Member Functions

 AppInstance (const std::string &rName)
 Constructor.
 ~AppInstance ()
 Destructor.
bool Lock ()
 Attempts to lock the instance.
void Unlock ()
 Unlocks the instance.
bool Exists () const
 Checks whether an instance of this application exists.
bool SendSignal (int iSigNo) const
 Sends a signal to an instance of this application.

Protected Member Functions

bool DoLock (const char *path)
std::string GetLockfile () const


Detailed Description

Application instance management class.

This class is intended for application which require to be running only once (one instance only). It provides some methods for simple locking, signaling etc.


Constructor & Destructor Documentation

AppInstance::AppInstance ( const std::string &  rName  ) 

Constructor.

Parameters:
[in] rName application name

AppInstance::~AppInstance (  ) 

Destructor.


Member Function Documentation

bool AppInstance::Lock (  ) 

Attempts to lock the instance.

This method attempts to create a lockfile. If the file already exists it checks whether its owner is still living. If it does this method fails. Otherwise it unlinks this file and re-attempts to create it.

Returns:
true = instance locked, false = otherwise

void AppInstance::Unlock (  ) 

Unlocks the instance.

This method removes (unlinks) the appropriate lockfile. If the instance hasn't been locked this method has no effect.

bool AppInstance::Exists (  )  const

Checks whether an instance of this application exists.

If this instance has acquired the lockfile the call will be successful. Otherwise it checks for existence of another running instance.

Returns:
true = instance exists, false = otherwise

bool AppInstance::SendSignal ( int  iSigNo  )  const

Sends a signal to an instance of this application.

This method doesn't signal the current instance.

Parameters:
[in] iSigNo signal number
Returns:
true = success, false = otherwise

bool AppInstance::DoLock ( const char *  path  )  [protected]

std::string AppInstance::GetLockfile (  )  const [protected]


The documentation for this class was generated from the following files:
Generated on Sat Jan 27 21:05:47 2007 for incron by  doxygen 1.5.1