libER 0.1.4.2
ELDEN RING API library
Loading...
Searching...
No Matches
kernel_runtime.hpp
Go to the documentation of this file.
1
8#pragma once
9
11#include <detail/preprocessor.hpp>
12#include <detail/minwin.inl>
13
14// Part of namespace DLKR and DLKRD
16
17#include <new>
18
19namespace from {
20// Windows Kernel runtime functionality;
21// mutexes, signals, allocators etc.
22namespace DLKR {
23// Non-copyable dummy (empty) synchronization object
25
35public:
36 LIBER_CLASS(DLPlainLightMutex);
37
38 LIBERAPI DLPlainLightMutex() noexcept;
39
46 LIBERAPI explicit DLPlainLightMutex(int spin_count) noexcept;
47
48 LIBERAPI virtual ~DLPlainLightMutex() noexcept;
49
55 LIBERAPI void lock() noexcept;
56
62 LIBERAPI void unlock() noexcept;
63
72 [[nodiscard]] LIBERAPI bool try_lock() noexcept;
73
74 DLPlainLightMutex(DLPlainLightMutex&&) noexcept = delete;
75
76private:
77 CRITICAL_SECTION critical_section;
78};
79
80LIBER_ASSERTS_BEGIN(DLPlainLightMutex);
81LIBER_ASSERT_SIZE(0x30);
82LIBER_ASSERTS_END;
83
92class DLPlainMutex : public DLUT::DLNonCopyable {
93public:
94 LIBER_CLASS(DLPlainMutex);
95
96 LIBERAPI DLPlainMutex() noexcept;
97
98 LIBERAPI virtual ~DLPlainMutex() noexcept;
99
105 LIBERAPI void lock() noexcept;
106
112 LIBERAPI void unlock() noexcept;
113
122 [[nodiscard]] LIBERAPI bool try_lock() noexcept;
123
124 DLPlainMutex(DLPlainMutex&&) noexcept = delete;
125
126private:
127 HANDLE mutex_handle;
128};
129
130LIBER_ASSERTS_BEGIN(DLPlainMutex);
131LIBER_ASSERT_SIZE(0x10);
132LIBER_ASSERTS_END;
133
143public:
144 LIBER_CLASS(DLPlainAdaptiveMutex);
145
146 DLPlainAdaptiveMutex() noexcept
147 : DLPlainLightMutex(4000), spin_count(4000) {}
148
155 explicit DLPlainAdaptiveMutex(int spin_count) noexcept
156 : DLPlainLightMutex(spin_count), spin_count(spin_count) {}
157
158 virtual ~DLPlainAdaptiveMutex() noexcept = default;
159
160 DLPlainAdaptiveMutex(DLPlainAdaptiveMutex&&) noexcept = delete;
161
162private:
163 int spin_count;
164};
165
166LIBER_ASSERTS_BEGIN(DLPlainAdaptiveMutex);
167LIBER_ASSERT_SIZE(0x38);
168LIBER_ASSERTS_END;
169} // namespace DLKR
170} // namespace from
Definition kernel_runtime.hpp:24
A wrapper around a Windows Critical Section (with a spincount).
Definition kernel_runtime.hpp:142
DLPlainAdaptiveMutex(int spin_count) noexcept
Initialize the Windows Critical Section with an explicit spin count.
Definition kernel_runtime.hpp:155
A wrapper around a Windows Critical Section.
Definition kernel_runtime.hpp:34
LIBERAPI void unlock() noexcept
Unlock the mutex.
LIBERAPI void lock() noexcept
Lock the mutex.
LIBERAPI DLPlainLightMutex(int spin_count) noexcept
Initialize the Windows Critical Section with an explicit spin count.
LIBERAPI bool try_lock() noexcept
Try to lock the mutex.
A wrapper around a Windows kernel mutex.
Definition kernel_runtime.hpp:92
LIBERAPI void lock() noexcept
Lock the mutex.
Base class used for non-copyable, but movable objects.
Definition utility.hpp:27
ELDEN RING allocation interface and from::allocator.
Dantelion2 utility.