Fixing thread exit.

This commit is contained in:
Ben Vanik 2015-07-15 18:01:17 -07:00
parent 42400d06a9
commit 99104a25a8
3 changed files with 9 additions and 12 deletions

View File

@ -310,6 +310,12 @@ class Thread : public WaitHandle {
static std::unique_ptr<Thread> Create(CreationParameters params,
std::function<void()> start_routine);
// Ends the calling thread.
// No destructors are called, and this function does not return.
// The state of the thread object becomes signaled, releasing any other
// threads that had been waiting for the thread to terminate.
static void Exit(int exit_code);
// Returns the current name of the thread, if previously specified.
std::string name() const { return name_; }
@ -348,12 +354,6 @@ class Thread : public WaitHandle {
// Suspends the specified thread.
virtual bool Suspend(uint32_t* out_previous_suspend_count = nullptr) = 0;
// Ends the calling thread.
// No destructors are called, and this function does not return.
// The state of the thread object becomes signaled, releasing any other
// threads that had been waiting for the thread to terminate.
virtual void Exit(int exit_code) = 0;
// Terminates the thread.
// No destructors are called, and this function does not return.
// The state of the thread object becomes signaled, releasing any other

View File

@ -357,11 +357,6 @@ class Win32Thread : public Win32Handle<Thread> {
return true;
}
void Exit(int exit_code) override {
AssertCallingThread();
ExitThread(exit_code);
}
void Terminate(int exit_code) override {
TerminateThread(handle_, exit_code);
}
@ -399,5 +394,7 @@ std::unique_ptr<Thread> Thread::Create(CreationParameters params,
return std::make_unique<Win32Thread>(handle);
}
void Thread::Exit(int exit_code) { ExitThread(exit_code); }
} // namespace threading
} // namespace xe

View File

@ -377,7 +377,7 @@ X_STATUS XThread::Exit(int exit_code) {
Release();
// NOTE: this does not return!
thread_->Exit(exit_code);
xe::threading::Thread::Exit(exit_code);
return X_STATUS_SUCCESS;
}