Fixing thread exit.
This commit is contained in:
parent
42400d06a9
commit
99104a25a8
|
@ -310,6 +310,12 @@ class Thread : public WaitHandle {
|
||||||
static std::unique_ptr<Thread> Create(CreationParameters params,
|
static std::unique_ptr<Thread> Create(CreationParameters params,
|
||||||
std::function<void()> start_routine);
|
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.
|
// Returns the current name of the thread, if previously specified.
|
||||||
std::string name() const { return name_; }
|
std::string name() const { return name_; }
|
||||||
|
|
||||||
|
@ -348,12 +354,6 @@ class Thread : public WaitHandle {
|
||||||
// Suspends the specified thread.
|
// Suspends the specified thread.
|
||||||
virtual bool Suspend(uint32_t* out_previous_suspend_count = nullptr) = 0;
|
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.
|
// Terminates the thread.
|
||||||
// No destructors are called, and this function does not return.
|
// No destructors are called, and this function does not return.
|
||||||
// The state of the thread object becomes signaled, releasing any other
|
// The state of the thread object becomes signaled, releasing any other
|
||||||
|
|
|
@ -357,11 +357,6 @@ class Win32Thread : public Win32Handle<Thread> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exit(int exit_code) override {
|
|
||||||
AssertCallingThread();
|
|
||||||
ExitThread(exit_code);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Terminate(int exit_code) override {
|
void Terminate(int exit_code) override {
|
||||||
TerminateThread(handle_, exit_code);
|
TerminateThread(handle_, exit_code);
|
||||||
}
|
}
|
||||||
|
@ -399,5 +394,7 @@ std::unique_ptr<Thread> Thread::Create(CreationParameters params,
|
||||||
return std::make_unique<Win32Thread>(handle);
|
return std::make_unique<Win32Thread>(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Thread::Exit(int exit_code) { ExitThread(exit_code); }
|
||||||
|
|
||||||
} // namespace threading
|
} // namespace threading
|
||||||
} // namespace xe
|
} // namespace xe
|
||||||
|
|
|
@ -377,7 +377,7 @@ X_STATUS XThread::Exit(int exit_code) {
|
||||||
Release();
|
Release();
|
||||||
|
|
||||||
// NOTE: this does not return!
|
// NOTE: this does not return!
|
||||||
thread_->Exit(exit_code);
|
xe::threading::Thread::Exit(exit_code);
|
||||||
return X_STATUS_SUCCESS;
|
return X_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue