AppInstance(3)

NAME
AppInstance -

Application instance management class'.

SYNOPSIS

#include <appinst.h>

  Public Member Functions
AppInstance (const std::string &rName, const std::string &rBase=APPLOCK_BASEDIR)
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'.
bool Terminate () const
Terminates an instance of this application'.

  Protected Member Functions
bool DoLock ()

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, const std::string &rBase = APPLOCK_BASEDIR)

Constructor'. Parameters:
    rName application name
    rBase lockfile base directory

Attention:
    If an empty base directory is given it is replaced by the default value'.

  AppInstance::~AppInstance ()

Destructor'.

Member Function Documentation

  bool AppInstance::DoLock () [protected]

  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::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

  bool AppInstance::SendSignal (intiSigNo) const

Sends a signal to an instance of this application'. This method doesn't signal the current instance'.

Parameters:
    iSigNo signal number

Returns:
    true = success, false = otherwise

  bool AppInstance::Terminate () const [inline]

Terminates an instance of this application'. This method doesn't terminate the current instance'.

Returns:
    true = success, 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'.

Author

Generated automatically by Doxygen for incron from the source code'.