Renamed handle_ to native_handle_ in some places where it makes more sense.
This commit is contained in:
parent
cabf9d6261
commit
dc371009d9
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,7 +81,7 @@ void XTimer::CompletionRoutine(XTimer* timer, DWORD timer_low,
|
|||
}
|
||||
|
||||
X_STATUS XTimer::Cancel() {
|
||||
return CancelWaitableTimer(handle_) == 0 ? X_STATUS_SUCCESS
|
||||
return CancelWaitableTimer(native_handle_) == 0 ? X_STATUS_SUCCESS
|
||||
: X_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
|
|
|
@ -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_;
|
||||
|
|
Loading…
Reference in New Issue