AppCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
efilelock.h
Go to the documentation of this file.
1 #ifndef EFILELOCK_H
2 #define EFILELOCK_H
3 
4 #include <unistd.h>
5 #include <string.h>
6 #include <fcntl.h>
7 
8 namespace EM
9 {
10  namespace EventDownloader
11  {
12  class EFileLock
13  {
14  private:
15  char *m_path;
16  int m_file;
17 
18  public:
19  EFileLock();
20  EFileLock( const char *path);
21  ~EFileLock();
22 
23  bool setPath( const char *path);
24  char* getPath();
25 
26  // tries to gain the lock (returns true if succeeded)
27  // multiple call of this method is OK
28  bool lock();
29 
30  // true = somebody else has lock
31  // false = unlocked or we have lock
32  bool check();
33 
34  // tries to release the lock (returns true if success)
35  bool unlock();
36  };
37 
38  }
39 }
40 
41 #endif
EFileLock()
Definition: efilelock.cpp:7
bool unlock()
Definition: efilelock.cpp:88
bool check()
Definition: efilelock.cpp:114
char * getPath()
Definition: efilelock.cpp:56
Definition: EventDownloaderH.h:12
bool setPath(const char *path)
Definition: efilelock.cpp:29
SYSTEM INCLUDES.
Definition: CardFacadeManagerXML.h:6
bool lock()
Definition: efilelock.cpp:61
~EFileLock()
Definition: efilelock.cpp:21