diff --git a/src/xenia/kernel/notify_listener.h b/src/xenia/kernel/notify_listener.h index fb5bfd573..47428252a 100644 --- a/src/xenia/kernel/notify_listener.h +++ b/src/xenia/kernel/notify_listener.h @@ -36,14 +36,15 @@ class NotifyListener : public XObject { bool DequeueNotification(XNotificationID* out_id, uint32_t* out_data); bool DequeueNotification(XNotificationID id, uint32_t* out_data); - xe::threading::WaitHandle* GetWaitHandle() override { - return wait_handle_.get(); - } - bool Save(ByteStream* stream) override; static object_ref Restore(KernelState* kernel_state, ByteStream* stream); + protected: + xe::threading::WaitHandle* GetWaitHandle() override { + return wait_handle_.get(); + } + private: std::unique_ptr wait_handle_; xe::global_critical_region global_critical_region_; diff --git a/src/xenia/kernel/xevent.h b/src/xenia/kernel/xevent.h index 3fa447825..a0b989461 100644 --- a/src/xenia/kernel/xevent.h +++ b/src/xenia/kernel/xevent.h @@ -37,12 +37,13 @@ class XEvent : public XObject { int32_t Reset(); void Clear(); - xe::threading::WaitHandle* GetWaitHandle() override { return event_.get(); } - bool Save(ByteStream* stream) override; static object_ref Restore(KernelState* kernel_state, ByteStream* stream); + protected: + xe::threading::WaitHandle* GetWaitHandle() override { return event_.get(); } + private: bool manual_reset_ = false; std::unique_ptr event_; diff --git a/src/xenia/kernel/xfile.h b/src/xenia/kernel/xfile.h index cb7426cf1..20d20bd66 100644 --- a/src/xenia/kernel/xfile.h +++ b/src/xenia/kernel/xfile.h @@ -104,10 +104,6 @@ class XFile : public XObject { X_STATUS Write(const void* buffer, size_t buffer_length, size_t byte_offset, size_t* out_bytes_written, uint32_t apc_context); - xe::threading::WaitHandle* GetWaitHandle() override { - return async_event_.get(); - } - void RegisterIOCompletionPort(uint32_t key, object_ref port); void RemoveIOCompletionPort(uint32_t key); @@ -118,6 +114,10 @@ class XFile : public XObject { protected: void NotifyIOCompletionPorts(XIOCompletion::IONotification& notification); + xe::threading::WaitHandle* GetWaitHandle() override { + return async_event_.get(); + } + private: XFile(); diff --git a/src/xenia/kernel/xmutant.h b/src/xenia/kernel/xmutant.h index bd4b8a839..e3b9cad22 100644 --- a/src/xenia/kernel/xmutant.h +++ b/src/xenia/kernel/xmutant.h @@ -30,13 +30,12 @@ class XMutant : public XObject { X_STATUS ReleaseMutant(uint32_t priority_increment, bool abandon, bool wait); - xe::threading::WaitHandle* GetWaitHandle() override { return mutant_.get(); } - bool Save(ByteStream* stream) override; static object_ref Restore(KernelState* kernel_state, ByteStream* stream); protected: + xe::threading::WaitHandle* GetWaitHandle() override { return mutant_.get(); } void WaitCallback() override; private: diff --git a/src/xenia/kernel/xobject.h b/src/xenia/kernel/xobject.h index e1e407277..db206a516 100644 --- a/src/xenia/kernel/xobject.h +++ b/src/xenia/kernel/xobject.h @@ -187,7 +187,6 @@ class XObject { static object_ref GetNativeObject(KernelState* kernel_state, void* native_ptr, int32_t as_type = -1); - virtual xe::threading::WaitHandle* GetWaitHandle() { return nullptr; } protected: bool SaveObject(ByteStream* stream); @@ -195,6 +194,7 @@ class XObject { // Called on successful wait. virtual void WaitCallback() {} + virtual xe::threading::WaitHandle* GetWaitHandle() { return nullptr; } // Creates the kernel object for guest code to use. Typically not needed. uint8_t* CreateNative(uint32_t size); diff --git a/src/xenia/kernel/xsemaphore.h b/src/xenia/kernel/xsemaphore.h index 3cfdc6bf7..1b0bc5804 100644 --- a/src/xenia/kernel/xsemaphore.h +++ b/src/xenia/kernel/xsemaphore.h @@ -34,14 +34,15 @@ class XSemaphore : public XObject { int32_t ReleaseSemaphore(int32_t release_count); - xe::threading::WaitHandle* GetWaitHandle() override { - return semaphore_.get(); - } - bool Save(ByteStream* stream) override; static object_ref Restore(KernelState* kernel_state, ByteStream* stream); + protected: + xe::threading::WaitHandle* GetWaitHandle() override { + return semaphore_.get(); + } + private: std::unique_ptr semaphore_; uint32_t maximum_count_ = 0; diff --git a/src/xenia/kernel/xthread.h b/src/xenia/kernel/xthread.h index 2ccc0d15b..1d5b34ee9 100644 --- a/src/xenia/kernel/xthread.h +++ b/src/xenia/kernel/xthread.h @@ -181,7 +181,6 @@ class XThread : public XObject { X_STATUS Delay(uint32_t processor_mode, uint32_t alertable, uint64_t interval); - xe::threading::WaitHandle* GetWaitHandle() override { return thread_.get(); } xe::threading::Thread* thread() { return thread_.get(); } virtual bool Save(ByteStream* stream) override; @@ -204,6 +203,8 @@ class XThread : public XObject { void DeliverAPCs(); void RundownAPCs(); + xe::threading::WaitHandle* GetWaitHandle() override { return thread_.get(); } + CreationParams creation_params_ = {0}; uint32_t thread_id_ = 0; diff --git a/src/xenia/kernel/xtimer.h b/src/xenia/kernel/xtimer.h index 052e3ea9c..15ec47cca 100644 --- a/src/xenia/kernel/xtimer.h +++ b/src/xenia/kernel/xtimer.h @@ -32,6 +32,7 @@ class XTimer : public XObject { uint32_t routine_arg, bool resume); X_STATUS Cancel(); + protected: xe::threading::WaitHandle* GetWaitHandle() override { return timer_.get(); } private: