From 5aff9d12eeed29c61feeb008b1968f04b5ca73fd Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Wed, 16 Dec 2015 17:07:43 -0600 Subject: [PATCH] Call XObject::WaitCallback on successful waits --- src/xenia/kernel/xobject.cc | 8 ++++++++ src/xenia/kernel/xobject.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/xenia/kernel/xobject.cc b/src/xenia/kernel/xobject.cc index 0e06f0200..0148b23f2 100644 --- a/src/xenia/kernel/xobject.cc +++ b/src/xenia/kernel/xobject.cc @@ -202,6 +202,7 @@ X_STATUS XObject::Wait(uint32_t wait_reason, uint32_t processor_mode, xe::threading::Wait(wait_handle, alertable ? true : false, timeout_ms); switch (result) { case xe::threading::WaitResult::kSuccess: + WaitCallback(); return X_STATUS_SUCCESS; case xe::threading::WaitResult::kUserCallback: // Or X_STATUS_ALERTED? @@ -229,6 +230,7 @@ X_STATUS XObject::SignalAndWait(XObject* signal_object, XObject* wait_object, alertable ? true : false, timeout_ms); switch (result) { case xe::threading::WaitResult::kSuccess: + wait_object->WaitCallback(); return X_STATUS_SUCCESS; case xe::threading::WaitResult::kUserCallback: // Or X_STATUS_ALERTED? @@ -263,6 +265,8 @@ X_STATUS XObject::WaitMultiple(uint32_t count, XObject** objects, alertable ? true : false, timeout_ms); switch (result.first) { case xe::threading::WaitResult::kSuccess: + objects[result.second]->WaitCallback(); + return X_STATUS(result.second); case xe::threading::WaitResult::kUserCallback: // Or X_STATUS_ALERTED? @@ -281,6 +285,10 @@ X_STATUS XObject::WaitMultiple(uint32_t count, XObject** objects, alertable ? true : false, timeout_ms); switch (result) { case xe::threading::WaitResult::kSuccess: + for (uint32_t i = 0; i < count; i++) { + objects[i]->WaitCallback(); + } + return X_STATUS_SUCCESS; case xe::threading::WaitResult::kUserCallback: // Or X_STATUS_ALERTED? diff --git a/src/xenia/kernel/xobject.h b/src/xenia/kernel/xobject.h index b5f31379d..e1e407277 100644 --- a/src/xenia/kernel/xobject.h +++ b/src/xenia/kernel/xobject.h @@ -193,6 +193,9 @@ class XObject { bool SaveObject(ByteStream* stream); bool RestoreObject(ByteStream* stream); + // Called on successful wait. + virtual void WaitCallback() {} + // Creates the kernel object for guest code to use. Typically not needed. uint8_t* CreateNative(uint32_t size); void SetNativePointer(uint32_t native_ptr, bool uninitialized = false);