00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef LOCK_H
00024 #define LOCK_H
00025
00026
00027
00028
00029
00030
00031
00032 #include <stdexcept>
00033 #include <boost/noncopyable.hpp>
00034
00035
00036 namespace storage
00037 {
00038
00039 class LockException : public std::exception
00040 {
00041
00042 public:
00043
00044 LockException(pid_t locker_pid);
00045 virtual ~LockException() throw();
00046
00047 pid_t getLockerPid() const { return locker_pid; }
00048
00049 protected:
00050
00051 pid_t locker_pid;
00052
00053 };
00054
00055
00059 class Lock : boost::noncopyable
00060 {
00061
00062 public:
00063
00064 Lock(bool readonly, bool disable = false);
00065 ~Lock() throw();
00066
00067 private:
00068
00069 bool disabled;
00070 int fd;
00071
00072 };
00073 }
00074
00075
00076 #endif