Back to index

courier  0.68.2
filelock.h
Go to the documentation of this file.
00001 #ifndef       filelock_h
00002 #define       filelock_h
00003 
00004 
00005 #include      "exittrap.h"
00006 
00008 //
00009 // Encapsulate the flock() system call.  By encapsulating the system call
00010 // in a class, this allows automatic cleanup if, for some reason, an
00011 // exception is thrown while a lock is being held.
00012 //
00014 
00015 class  FileLock : public ExitTrap {
00016 
00017        void   cleanup();
00018        void   forked();
00019 
00020        int    fd;
00021 public:
00022        FileLock();
00023        virtual ~FileLock();
00024        void   Lock(const char *);
00025        void   UnLock();
00026 
00027 static void   do_filelock(int);
00028 } ;
00029 
00030 #endif