From dc371009d9de8d163ecae59e73c4d3aaf3ab0b50 Mon Sep 17 00:00:00 2001 From: gibbed Date: Wed, 10 Jun 2015 21:18:12 -0500 Subject: [PATCH] Renamed handle_ to native_handle_ in some places where it makes more sense. --- src/xenia/kernel/objects/xevent.cc | 23 ++++++++++++----------- src/xenia/kernel/objects/xevent.h | 4 ++-- src/xenia/kernel/objects/xmutant.cc | 14 +++++++------- src/xenia/kernel/objects/xmutant.h | 4 ++-- src/xenia/kernel/objects/xsemaphore.cc | 14 +++++++------- src/xenia/kernel/objects/xsemaphore.h | 4 ++-- src/xenia/kernel/objects/xtimer.cc | 16 ++++++++-------- src/xenia/kernel/objects/xtimer.h | 4 ++-- 8 files changed, 42 insertions(+), 41 deletions(-) diff --git a/src/xenia/kernel/objects/xevent.cc b/src/xenia/kernel/objects/xevent.cc index 6338f4d22..f1e7a39d5 100644 --- a/src/xenia/kernel/objects/xevent.cc +++ b/src/xenia/kernel/objects/xevent.cc @@ -7,28 +7,29 @@ ****************************************************************************** */ +#include "xenia/base/logging.h" #include "xenia/kernel/objects/xevent.h" namespace xe { namespace kernel { XEvent::XEvent(KernelState* kernel_state) - : XObject(kernel_state, kTypeEvent), handle_(NULL) {} + : XObject(kernel_state, kTypeEvent), native_handle_(NULL) {} XEvent::~XEvent() { - if (handle_) { - CloseHandle(handle_); + if (native_handle_) { + CloseHandle(native_handle_); } } void XEvent::Initialize(bool manual_reset, bool initial_state) { - assert_null(handle_); + assert_null(native_handle_); - handle_ = CreateEvent(NULL, manual_reset, initial_state, NULL); + native_handle_ = CreateEvent(NULL, manual_reset, initial_state, NULL); } void XEvent::InitializeNative(void* native_ptr, DISPATCH_HEADER& header) { - assert_null(handle_); + assert_null(native_handle_); bool manual_reset; switch ((header.type_flags >> 24) & 0xFF) { @@ -45,20 +46,20 @@ void XEvent::InitializeNative(void* native_ptr, DISPATCH_HEADER& header) { bool initial_state = header.signal_state ? true : false; - handle_ = CreateEvent(NULL, manual_reset, initial_state, NULL); + native_handle_ = CreateEvent(NULL, manual_reset, initial_state, NULL); } int32_t XEvent::Set(uint32_t priority_increment, bool wait) { - return SetEvent(handle_) ? 1 : 0; + return SetEvent(native_handle_) ? 1 : 0; } int32_t XEvent::Pulse(uint32_t priority_increment, bool wait) { - return PulseEvent(handle_) ? 1 : 0; + return PulseEvent(native_handle_) ? 1 : 0; } -int32_t XEvent::Reset() { return ResetEvent(handle_) ? 1 : 0; } +int32_t XEvent::Reset() { return ResetEvent(native_handle_) ? 1 : 0; } -void XEvent::Clear() { ResetEvent(handle_); } +void XEvent::Clear() { ResetEvent(native_handle_); } } // namespace kernel } // namespace xe diff --git a/src/xenia/kernel/objects/xevent.h b/src/xenia/kernel/objects/xevent.h index 831666a50..68c06044f 100644 --- a/src/xenia/kernel/objects/xevent.h +++ b/src/xenia/kernel/objects/xevent.h @@ -29,10 +29,10 @@ class XEvent : public XObject { int32_t Reset(); void Clear(); - virtual void* GetWaitHandle() { return handle_; } + virtual void* GetWaitHandle() { return native_handle_; } private: - HANDLE handle_; + HANDLE native_handle_; }; } // namespace kernel diff --git a/src/xenia/kernel/objects/xmutant.cc b/src/xenia/kernel/objects/xmutant.cc index bb73a6260..006697def 100644 --- a/src/xenia/kernel/objects/xmutant.cc +++ b/src/xenia/kernel/objects/xmutant.cc @@ -13,22 +13,22 @@ namespace xe { namespace kernel { XMutant::XMutant(KernelState* kernel_state) - : XObject(kernel_state, kTypeMutant), handle_(NULL) {} + : XObject(kernel_state, kTypeMutant), native_handle_(NULL) {} XMutant::~XMutant() { - if (handle_) { - CloseHandle(handle_); + if (native_handle_) { + CloseHandle(native_handle_); } } void XMutant::Initialize(bool initial_owner) { - assert_null(handle_); + assert_null(native_handle_); - handle_ = CreateMutex(NULL, initial_owner ? TRUE : FALSE, NULL); + native_handle_ = CreateMutex(NULL, initial_owner ? TRUE : FALSE, NULL); } void XMutant::InitializeNative(void* native_ptr, DISPATCH_HEADER& header) { - assert_null(handle_); + assert_null(native_handle_); // Haven't seen this yet, but it's possible. assert_always(); @@ -38,7 +38,7 @@ X_STATUS XMutant::ReleaseMutant(uint32_t priority_increment, bool abandon, bool wait) { // TODO(benvanik): abandoning. assert_false(abandon); - BOOL result = ReleaseMutex(handle_); + BOOL result = ReleaseMutex(native_handle_); if (result) { return X_STATUS_SUCCESS; } else { diff --git a/src/xenia/kernel/objects/xmutant.h b/src/xenia/kernel/objects/xmutant.h index 11da04699..bc62a1b53 100644 --- a/src/xenia/kernel/objects/xmutant.h +++ b/src/xenia/kernel/objects/xmutant.h @@ -26,10 +26,10 @@ class XMutant : public XObject { X_STATUS ReleaseMutant(uint32_t priority_increment, bool abandon, bool wait); - virtual void* GetWaitHandle() { return handle_; } + virtual void* GetWaitHandle() { return native_handle_; } private: - HANDLE handle_; + HANDLE native_handle_; }; } // namespace kernel diff --git a/src/xenia/kernel/objects/xsemaphore.cc b/src/xenia/kernel/objects/xsemaphore.cc index be1472463..72d473d96 100644 --- a/src/xenia/kernel/objects/xsemaphore.cc +++ b/src/xenia/kernel/objects/xsemaphore.cc @@ -13,22 +13,22 @@ namespace xe { namespace kernel { XSemaphore::XSemaphore(KernelState* kernel_state) - : XObject(kernel_state, kTypeSemaphore), handle_(NULL) {} + : XObject(kernel_state, kTypeSemaphore), native_handle_(NULL) {} XSemaphore::~XSemaphore() { - if (handle_) { - CloseHandle(handle_); + if (native_handle_) { + CloseHandle(native_handle_); } } void XSemaphore::Initialize(int32_t initial_count, int32_t maximum_count) { - assert_null(handle_); + assert_null(native_handle_); - handle_ = CreateSemaphore(NULL, initial_count, maximum_count, NULL); + native_handle_ = CreateSemaphore(NULL, initial_count, maximum_count, NULL); } void XSemaphore::InitializeNative(void* native_ptr, DISPATCH_HEADER& header) { - assert_null(handle_); + assert_null(native_handle_); // NOT IMPLEMENTED // We expect Initialize to be called shortly. @@ -36,7 +36,7 @@ void XSemaphore::InitializeNative(void* native_ptr, DISPATCH_HEADER& header) { int32_t XSemaphore::ReleaseSemaphore(int32_t release_count) { LONG previous_count = 0; - ::ReleaseSemaphore(handle_, release_count, &previous_count); + ::ReleaseSemaphore(native_handle_, release_count, &previous_count); return previous_count; } diff --git a/src/xenia/kernel/objects/xsemaphore.h b/src/xenia/kernel/objects/xsemaphore.h index 892d3d70a..fd693d72a 100644 --- a/src/xenia/kernel/objects/xsemaphore.h +++ b/src/xenia/kernel/objects/xsemaphore.h @@ -26,10 +26,10 @@ class XSemaphore : public XObject { int32_t ReleaseSemaphore(int32_t release_count); - virtual void* GetWaitHandle() { return handle_; } + virtual void* GetWaitHandle() { return native_handle_; } private: - HANDLE handle_; + HANDLE native_handle_; }; } // namespace kernel diff --git a/src/xenia/kernel/objects/xtimer.cc b/src/xenia/kernel/objects/xtimer.cc index fdab85f73..8052775b6 100644 --- a/src/xenia/kernel/objects/xtimer.cc +++ b/src/xenia/kernel/objects/xtimer.cc @@ -17,16 +17,16 @@ namespace xe { namespace kernel { XTimer::XTimer(KernelState* kernel_state) - : XObject(kernel_state, kTypeTimer), handle_(NULL) {} + : XObject(kernel_state, kTypeTimer), native_handle_(NULL) {} XTimer::~XTimer() { - if (handle_) { - CloseHandle(handle_); + if (native_handle_) { + CloseHandle(native_handle_); } } void XTimer::Initialize(uint32_t timer_type) { - assert_null(handle_); + assert_null(native_handle_); bool manual_reset = false; switch (timer_type) { @@ -41,7 +41,7 @@ void XTimer::Initialize(uint32_t timer_type) { break; } - handle_ = CreateWaitableTimer(NULL, manual_reset, NULL); + native_handle_ = CreateWaitableTimer(NULL, manual_reset, NULL); } X_STATUS XTimer::SetTimer(int64_t due_time, uint32_t period_ms, @@ -56,7 +56,7 @@ X_STATUS XTimer::SetTimer(int64_t due_time, uint32_t period_ms, LARGE_INTEGER due_time_li; due_time_li.QuadPart = due_time; BOOL result = - SetWaitableTimer(handle_, &due_time_li, period_ms, + SetWaitableTimer(native_handle_, &due_time_li, period_ms, routine ? (PTIMERAPCROUTINE)CompletionRoutine : NULL, this, resume ? TRUE : FALSE); @@ -81,8 +81,8 @@ void XTimer::CompletionRoutine(XTimer* timer, DWORD timer_low, } X_STATUS XTimer::Cancel() { - return CancelWaitableTimer(handle_) == 0 ? X_STATUS_SUCCESS - : X_STATUS_UNSUCCESSFUL; + return CancelWaitableTimer(native_handle_) == 0 ? X_STATUS_SUCCESS + : X_STATUS_UNSUCCESSFUL; } } // namespace kernel diff --git a/src/xenia/kernel/objects/xtimer.h b/src/xenia/kernel/objects/xtimer.h index bf7fffffb..c949f020d 100644 --- a/src/xenia/kernel/objects/xtimer.h +++ b/src/xenia/kernel/objects/xtimer.h @@ -28,10 +28,10 @@ class XTimer : public XObject { uint32_t routine_arg, bool resume); X_STATUS Cancel(); - virtual void* GetWaitHandle() { return handle_; } + virtual void* GetWaitHandle() { return native_handle_; } private: - HANDLE handle_; + HANDLE native_handle_; uint32_t current_routine_; uint32_t current_routine_arg_;