ReXGlue SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
mutant_object.h
Go to the documentation of this file.
1
17
18
#pragma once
19
20
#include <atomic>
21
#include <memory>
22
#include <mutex>
23
24
#include <
rex/assert.h
>
25
#include <
rex/kernel/object/object.h
>
26
#include <
rex/kernel/types/list.h
>
27
#include <
rex/kernel/types/memory.h
>
28
#include <
rex/kernel/types/status.h
>
29
#include <
rex/kernel/types/thread.h
>
30
#include <
rex/module.h
>
31
#include <
rex/platform.h
>
32
#include <
rex/platform/sync.h
>
33
#include <
rex/platform/thread.h
>
34
#include <
rex/platform/timer.h
>
35
#include <
rex/result.h
>
36
#include <
rex/types.h
>
37
#include <
rex/utility.h
>
38
39
namespace
rex::kernel
{
40
41
struct
X_KMUTANT
{
43
X_DISPATCH_HEADER
header
;
45
X_LIST_ENTRY
mutant_list_entry
;
47
be_u32
owner_thread
;
49
u8
abandoned
;
50
u8 reserved[3];
51
};
52
REX_STATIC_ASSERT_SIZE(
X_KMUTANT
, 0x20);
53
54
struct
MutantObject {
55
MutantObject() =
default
;
56
61
REX_KERNEL_API
explicit
MutantObject
(
bool
initial_owner, u32 guest_mutant_in = 0);
62
63
PublishedPtr<rex::platform::Mutant>
mutant
;
65
std::atomic<u32>
owner_thread_id
{0};
66
std::atomic<i32>
hold_count
{0};
68
std::atomic<bool>
abandoned
{
false
};
70
u32
guest_mutant
= 0;
72
std::mutex
state_mutex
;
73
81
REX_KERNEL_API
X_STATUS
Release
(
bool
abandon, i32* previous_state =
nullptr
);
82
90
REX_KERNEL_API
bool
OnAcquired
(
const
rex::platform::WaitHandle
* waited);
91
97
REX_KERNEL_API
void
Adopt
(MutantObject& fresh);
98
};
99
100
}
// namespace rex::kernel
assert.h
rex::kernel::PublishedPtr
Definition
object.h:190
rex::platform::WaitHandle
Definition
sync.h:58
memory.h
Virtual memory flags and typed guest pointers.
thread.h
list.h
Guest list and spin lock structures.
module.h
Interfaces, factory and module declaration.
rex::kernel
Definition
export.h:24
rex::kernel::X_STATUS
u32 X_STATUS
Definition
status.h:23
object.h
thread.h
platform.h
Platform flags, packing macros and export markers.
REX_KERNEL_API
#define REX_KERNEL_API
Definition
platform.h:297
result.h
status.h
rex::kernel::MutantObject::Adopt
void Adopt(MutantObject &fresh)
rex::kernel::MutantObject::state_mutex
std::mutex state_mutex
Definition
mutant_object.h:72
rex::kernel::MutantObject::Release
X_STATUS Release(bool abandon, i32 *previous_state=nullptr)
rex::kernel::MutantObject::mutant
PublishedPtr< rex::platform::Mutant > mutant
Definition
mutant_object.h:63
rex::kernel::MutantObject::hold_count
std::atomic< i32 > hold_count
Definition
mutant_object.h:66
rex::kernel::MutantObject::OnAcquired
bool OnAcquired(const rex::platform::WaitHandle *waited)
rex::kernel::MutantObject::MutantObject
MutantObject(bool initial_owner, u32 guest_mutant_in=0)
rex::kernel::MutantObject::guest_mutant
u32 guest_mutant
Definition
mutant_object.h:70
rex::kernel::MutantObject::owner_thread_id
std::atomic< u32 > owner_thread_id
Definition
mutant_object.h:65
rex::kernel::MutantObject::abandoned
std::atomic< bool > abandoned
Definition
mutant_object.h:68
rex::kernel::X_DISPATCH_HEADER
Definition
thread.h:70
rex::kernel::X_KMUTANT
Definition
mutant_object.h:41
rex::kernel::X_KMUTANT::mutant_list_entry
X_LIST_ENTRY mutant_list_entry
Definition
mutant_object.h:45
rex::kernel::X_KMUTANT::header
X_DISPATCH_HEADER header
Definition
mutant_object.h:43
rex::kernel::X_KMUTANT::abandoned
u8 abandoned
Definition
mutant_object.h:49
rex::kernel::X_KMUTANT::owner_thread
be_u32 owner_thread
Definition
mutant_object.h:47
rex::kernel::X_LIST_ENTRY
Definition
list.h:24
sync.h
Wait objects and wait functions.
timer.h
types.h
Integer types, byte order wrappers and size literals.
utility.h
Move only function, const propagating pointer and scope guard.
rex
kernel
object
mutant_object.h
Generated by
1.18.0