summaryrefslogtreecommitdiffstats
path: root/maildrop/dotlock.h
blob: 67c22b0e11af02217e40947c73fafb12bc6a7050 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef	dotlock_h
#define	dotlock_h


#include	"tempfile.h"
#include	"dotlockrefresh.h"

/////////////////////////////////////////////////////////////////////////////
//
// Well, here's my attempt to do dot locking.
//
/////////////////////////////////////////////////////////////////////////////

class DotLock : public TempFile {

	int attemptlock(const char *, const char *);
	void	Refreshlock();
	DotLockRefresh refresh;
	void	dorefresh();

	unsigned	refresh_interval;
public:
	DotLock();
	~DotLock();

	void	Lock(const char *);
	void	LockMailbox(const char *);
	void	Unlock();
		//
		// Sounds simple, right?  <sigh>

	friend	class DotLockRefresh;

private:
static unsigned GetLockSleep();
static unsigned GetLockTimeout();
static unsigned GetLockRefresh();
static const	char *GetLockExt();

} ;
#endif