Subversion Repositories public

Rev

Rev 69 | Rev 73 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 69 Rev 71
Line 23... Line 23...
23
23
24
24
25
#include <string>
25
#include <string>
26
26
27
27
-
 
28
#define APPLOCK_BASEDIR "/var/run"
-
 
29
-
 
30
28
/// Exception class.
31
/// Exception class.
29
/**
32
/**
30
 * This class provides information about occurred errors.
33
 * This class provides information about occurred errors.
31
 */
34
 */
32
class AppInstException
35
class AppInstException
Line 62... Line 65...
62
{
65
{
63
public:
66
public:
64
  /// Constructor.
67
  /// Constructor.
65
  /**
68
  /**
66
   * \param[in] rName application name
69
   * \param[in] rName application name
-
 
70
   * \param[in] rBase lockfile base directory
-
 
71
   *
-
 
72
   * \attention If an empty base directory is given it is replaced by
-
 
73
   *            the default value.
67
   */
74
   */
68
  AppInstance(const std::string& rName);
75
  AppInstance(const std::string& rName, const std::string& rBase = APPLOCK_BASEDIR);
69
 
76
 
70
  /// Destructor.
77
  /// Destructor.
71
  ~AppInstance();
78
  ~AppInstance();
72
 
79
 
73
  /// Attempts to lock the instance.
80
  /// Attempts to lock the instance.
Line 107... Line 114...
107
   * \return true = success, false = otherwise
114
   * \return true = success, false = otherwise
108
   */
115
   */
109
  bool SendSignal(int iSigNo) const;
116
  bool SendSignal(int iSigNo) const;
110
 
117
 
111
protected:
118
protected:
112
  bool DoLock(const char* path);
119
  bool DoLock();
113
-
 
114
  std::string GetLockfile() const;
-
 
115
 
120
 
116
private:
121
private:
117
  std::string m_name;
122
  std::string m_path;
118
  bool m_fLocked;
123
  bool m_fLocked;
119
};
124
};
120
125
121
#endif /*APPINST_H_*/
126
#endif /*APPINST_H_*/