00001
00003
00021 #ifndef APPINST_H_
00022 #define APPINST_H_
00023
00024
00025 #include <string>
00026
00027
00029
00032 class AppInstException
00033 {
00034 public:
00036
00039 AppInstException(int iErr) : m_iErr(iErr) {}
00040
00042
00045 inline int GetErrorNumber() const
00046 {
00047 return m_iErr;
00048 }
00049
00050 private:
00051 int m_iErr;
00052
00053 };
00054
00056
00061 class AppInstance
00062 {
00063 public:
00065
00068 AppInstance(const std::string& rName);
00069
00071 ~AppInstance();
00072
00074
00082 bool Lock();
00083
00085
00090 void Unlock();
00091
00093
00100 bool Exists() const;
00101
00103
00109 bool SendSignal(int iSigNo) const;
00110
00111 protected:
00112 bool DoLock(const char* path);
00113
00114 std::string GetLockfile() const;
00115
00116 private:
00117 std::string m_name;
00118 bool m_fLocked;
00119 };
00120
00121 #endif