36 ThreadPin() =
default;
39 ThreadPin(
ThreadPin&& other) noexcept : thread_(other.thread_) { other.thread_ =
nullptr; }
40 ThreadPin& operator=(ThreadPin&& other)
noexcept {
43 thread_ = other.thread_;
44 other.thread_ =
nullptr;
48 ~ThreadPin() { Reset(); }
50 explicit operator bool() const noexcept {
return thread_ !=
nullptr; }
51 KernelThread* operator->() const noexcept {
return thread_; }
52 KernelThread& operator*() const noexcept {
return *thread_; }
53 [[nodiscard]] KernelThread* GetThread() const noexcept {
return thread_; }
55 void Reset() noexcept {
56 if (thread_ !=
nullptr) {
57 if (thread_->pins.Unpin()) {
65 KernelThread* thread_ =
nullptr;
72 u32 guest_context_addr;
90 std::chrono::milliseconds timeout) = 0;
102 u32 alertable, u64* opt_timeout) = 0;
115 u32 wait_reason, u32 processor_mode, u32 alertable,
116 u64* opt_timeout) = 0;
125 std::span<const rex::platform::SocketWait> sockets, std::chrono::milliseconds timeout) = 0;
137 [[nodiscard]] virtual
Result<X_HANDLE> Launch(std::unique_ptr<
KernelThread> thread) = 0;
146 [[nodiscard]] virtual
Result<X_HANDLE> CreateTaskThread(u32 start_address, u32 start_context) = 0;
154 virtual
void SleepCurrentThread(std::chrono::microseconds duration) = 0;
161 [[nodiscard]] virtual
ThreadPin Find(u32 thread_id) = 0;
169 [[nodiscard]] virtual
ThreadPin FindByHandle(X_HANDLE handle) = 0;
171 [[nodiscard]] virtual std::vector<
ThreadPin> All() = 0;
178 [[nodiscard]] virtual std::optional<u32> AllocateTLS(
PPCContext* context) = 0;
181 virtual
void FreeTLS(
PPCContext* context, u32 slot) = 0;
189 [[nodiscard]] virtual std::optional<
GuestFiber> FindFiber(u32 address) = 0;
196 virtual
void RegisterFiber(u32 address, const
GuestFiber& info) = 0;
198 virtual
void UnregisterFiber(u32 address) = 0;
206 [[nodiscard]] virtual const
char* GetOrCreateFiberName(u32 fiber_uid,
207 const
char* thread_name) = 0;
214 virtual
void RegisterThreadNotify(u32 notification) = 0;
221 virtual
void UnregisterThreadNotify(u32 notification) = 0;
236 std::optional<u32>
length = std::nullopt;
306 virtual
bool Queue(u32 dpc, u32 arg1, u32 arg2) = 0;
314 virtual
bool Remove(u32 dpc) = 0;
320 virtual
void Drain() = 0;
Definition kernel_thread.h:59
Definition thread_registry.h:295
Definition thread_registry.h:79
virtual rex::platform::WaitResult WaitHostSockets(std::span< const rex::platform::SocketWait > sockets, std::chrono::milliseconds timeout)=0
virtual X_STATUS WaitGuestObject(X_HANDLE handle, u32 wait_reason, u32 processor_mode, u32 alertable, u64 *opt_timeout)=0
virtual rex::platform::WaitResult WaitHostObject(rex::platform::WaitHandle *handle, std::chrono::milliseconds timeout)=0
virtual X_STATUS WaitGuestObjects(std::span< const X_HANDLE > handles, u32 wait_type, u32 wait_reason, u32 processor_mode, u32 alertable, u64 *opt_timeout)=0
Definition thread_registry.h:240
Definition thread_registry.h:129
Definition kernel_thread.h:72
Definition thread_registry.h:34
ThreadPin(KernelThread *thread) noexcept
Definition thread_registry.h:38
Interfaces, factory and module declaration.
#define REX_DECLARE_INTERFACE(Name, version)
Definition module.h:114
u32 X_STATUS
Definition status.h:23
u32 X_RESULT
Definition status.h:92
typename detail::MoveOnlyFunctionFor< Signature >::type MoveOnlyFunction
Definition utility.h:254
std::expected< T, Error > Result
Definition result.h:98
Definition thread_registry.h:232
std::optional< u32 > length
Definition thread_registry.h:236
std::optional< u32 > extended_error
Definition thread_registry.h:234
Definition thread_registry.h:69
u32 guest_stack_bottom
Definition thread_registry.h:73
bool is_thread_fiber
Definition thread_registry.h:74
u32 uid
Definition thread_registry.h:71
Wait objects and wait functions.
Integer types, byte order wrappers and size literals.
Move only function, const propagating pointer and scope guard.