blob: e50856e1b4b8a29caea43f84c6450c0005ac9cbc (
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
|