ReXGlue SDK
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>
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
39namespace rex::kernel {
40
52REX_STATIC_ASSERT_SIZE(X_KMUTANT, 0x20);
53
54struct MutantObject {
55 MutantObject() = default;
56
61 REX_KERNEL_API explicit MutantObject(bool initial_owner, u32 guest_mutant_in = 0);
62
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
91
97 REX_KERNEL_API void Adopt(MutantObject& fresh);
98};
99
100} // namespace rex::kernel
Definition object.h:190
Definition sync.h:58
Virtual memory flags and typed guest pointers.
Guest list and spin lock structures.
Interfaces, factory and module declaration.
Definition export.h:24
u32 X_STATUS
Definition status.h:23
Platform flags, packing macros and export markers.
#define REX_KERNEL_API
Definition platform.h:297
void Adopt(MutantObject &fresh)
std::mutex state_mutex
Definition mutant_object.h:72
X_STATUS Release(bool abandon, i32 *previous_state=nullptr)
PublishedPtr< rex::platform::Mutant > mutant
Definition mutant_object.h:63
std::atomic< i32 > hold_count
Definition mutant_object.h:66
bool OnAcquired(const rex::platform::WaitHandle *waited)
MutantObject(bool initial_owner, u32 guest_mutant_in=0)
u32 guest_mutant
Definition mutant_object.h:70
std::atomic< u32 > owner_thread_id
Definition mutant_object.h:65
std::atomic< bool > abandoned
Definition mutant_object.h:68
Definition thread.h:70
Definition mutant_object.h:41
X_LIST_ENTRY mutant_list_entry
Definition mutant_object.h:45
X_DISPATCH_HEADER header
Definition mutant_object.h:43
u8 abandoned
Definition mutant_object.h:49
be_u32 owner_thread
Definition mutant_object.h:47
Definition list.h:24
Wait objects and wait functions.
Integer types, byte order wrappers and size literals.
Move only function, const propagating pointer and scope guard.