1 #ifndef	filelock_h
2 #define	filelock_h
3 
4 static const char filelock_h_rcsid[]="$Id: filelock.h,v 1.2 1998/08/31 03:54:50 mrsam Exp $";
5 
6 #include	"exittrap.h"
7 
8 /////////////////////////////////////////////////////////////////////////////
9 //
10 // Encapsulate the flock() system call.  By encapsulating the system call
11 // in a class, this allows automatic cleanup if, for some reason, an
12 // exception is thrown while a lock is being held.
13 //
14 /////////////////////////////////////////////////////////////////////////////
15 
16 class	FileLock : public ExitTrap {
17 
18 	void	cleanup();
19 	void	forked();
20 
21 	int	fd;
22 public:
23 	FileLock();
24 	virtual ~FileLock();
25 	void	Lock(const char *);
26 	void	UnLock();
27 
28 static	void	do_filelock(int);
29 } ;
30 
31 #endif
32