Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Mutex_WIN32.h
Go to the documentation of this file.
1
//
2
// Mutex_WIN32.h
3
//
4
// Library: Foundation
5
// Package: Threading
6
// Module: Mutex
7
//
8
// Definition of the MutexImpl and FastMutexImpl classes for WIN32.
9
//
10
// Copyright (c) 2004-2008, Applied Informatics Software Engineering GmbH.
11
// and Contributors.
12
//
13
// SPDX-License-Identifier: BSL-1.0
14
//
15
16
17
#
ifndef
Foundation_Mutex_WIN32_INCLUDED
18
#
define
Foundation_Mutex_WIN32_INCLUDED
19
20
21
#
include
"Poco/Foundation.h"
22
#
include
"Poco/Exception.h"
23
#
include
"Poco/UnWindows.h"
24
25
26
namespace
Poco
{
27
28
29
class
Foundation_API
MutexImpl
30
{
31
protected
:
32
MutexImpl
();
33
~
MutexImpl
();
34
void
lockImpl
();
35
bool
tryLockImpl
();
36
bool
tryLockImpl
(
long
milliseconds);
37
void
unlockImpl
();
38
39
private
:
40
CRITICAL_SECTION
_cs
;
41
};
42
43
44
typedef
MutexImpl
FastMutexImpl
;
45
46
47
//
48
// inlines
49
//
50
inline
void
MutexImpl
::
lockImpl
()
51
{
52
try
53
{
54
EnterCriticalSection(&
_cs
);
55
}
56
catch
(...)
57
{
58
throw
SystemException(
"cannot lock mutex"
);
59
}
60
}
61
62
63
inline
bool
MutexImpl
::
tryLockImpl
()
64
{
65
try
66
{
67
return
TryEnterCriticalSection(&
_cs
) != 0;
68
}
69
catch
(...)
70
{
71
}
72
throw
SystemException(
"cannot lock mutex"
);
73
}
74
75
76
inline
void
MutexImpl
::
unlockImpl
()
77
{
78
LeaveCriticalSection(&
_cs
);
79
}
80
81
82
}
// namespace Poco
83
84
85
#
endif
// Foundation_Mutex_WIN32_INCLUDED
Foundation_API
#define Foundation_API
Definition
Foundation.h:60
Poco::MutexImpl
Definition
Mutex_WIN32.h:30
Poco::MutexImpl::lockImpl
void lockImpl()
Definition
Mutex_WIN32.h:50
Poco::MutexImpl::MutexImpl
MutexImpl()
Poco::MutexImpl::~MutexImpl
~MutexImpl()
Poco::MutexImpl::tryLockImpl
bool tryLockImpl(long milliseconds)
Poco::MutexImpl::unlockImpl
void unlockImpl()
Definition
Mutex_WIN32.h:76
Poco::MutexImpl::tryLockImpl
bool tryLockImpl()
Definition
Mutex_WIN32.h:63
Poco::MutexImpl::_cs
CRITICAL_SECTION _cs
Definition
Mutex_WIN32.h:40
Poco
Definition
HTTPSClientSession.h:29
Poco::FastMutexImpl
MutexImpl FastMutexImpl
Definition
Mutex_WIN32.h:44
Downloads
ArkServerAPI_NEW
ASE
AseApi-main
include
Poco
Poco
Mutex_WIN32.h
Generated by
1.10.0