aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/Foundation/include/Poco/RWLock_WIN32.h
blob: 0af13e67aba611f395c98fbb25a24dd331e5f317 (plain) (blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// 
// RWLock_WIN32.h 
// 
// Library: Foundation 
// Package: Threading 
// Module:  RWLock 
// 
// Definition of the RWLockImpl class for WIN32. 
// 
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. 
// and Contributors. 
// 
// SPDX-License-Identifier:	BSL-1.0 
// 
 
 
#ifndef Foundation_RWLock_WIN32_INCLUDED 
#define Foundation_RWLock_WIN32_INCLUDED 
 
 
#include "Poco/Foundation.h" 
#include "Poco/Exception.h" 
#include "Poco/UnWindows.h" 
 
 
namespace Poco { 
 
 
class Foundation_API RWLockImpl 
{ 
protected: 
	RWLockImpl(); 
	~RWLockImpl(); 
	void readLockImpl(); 
	bool tryReadLockImpl(); 
	void writeLockImpl(); 
	bool tryWriteLockImpl(); 
	void unlockImpl(); 
	 
private: 
	void addWriter(); 
	void removeWriter(); 
	DWORD tryReadLockOnce(); 
 
	HANDLE   _mutex; 
	HANDLE   _readEvent; 
	HANDLE   _writeEvent; 
	unsigned _readers; 
	unsigned _writersWaiting; 
	unsigned _writers; 
}; 
 
 
} // namespace Poco 
 
 
#endif // Foundation_RWLock_WIN32_INCLUDED