Remove processor dependency on XThread for breakpoints

This commit is contained in:
Dr. Chat
2015-11-28 13:12:01 -06:00
committed by Ben Vanik
parent 666f5543a8
commit 42c657c40a
3 changed files with 13 additions and 5 deletions

View File

@@ -442,7 +442,7 @@ std::unique_ptr<Thread> Thread::Create(CreationParameters params,
HANDLE handle =
CreateThread(NULL, params.stack_size, ThreadStartRoutine, start_data,
params.create_suspended ? CREATE_SUSPENDED : 0, NULL);
if (!handle) {
if (handle == INVALID_HANDLE_VALUE) {
// TODO(benvanik): pass back?
auto last_error = GetLastError();
XELOGE("Unable to CreateThread: %d", last_error);
@@ -453,6 +453,15 @@ std::unique_ptr<Thread> Thread::Create(CreationParameters params,
return std::make_unique<Win32Thread>(handle);
}
std::unique_ptr<Thread> Thread::GetCurrentThread() {
HANDLE handle = ::GetCurrentThread();
if (handle == INVALID_HANDLE_VALUE) {
return nullptr;
}
return std::make_unique<Win32Thread>(handle);
}
void Thread::Exit(int exit_code) { ExitThread(exit_code); }
} // namespace threading