Mark XThreads as running before calling Execute

This commit is contained in:
Dr. Chat 2015-12-28 12:33:29 -06:00 committed by Ben Vanik
parent 6108ff1608
commit c242a01043
1 changed files with 2 additions and 2 deletions

View File

@ -378,7 +378,9 @@ X_STATUS XThread::Create() {
// Execute user code. // Execute user code.
current_thread_tls_ = this; current_thread_tls_ = this;
running_ = true;
Execute(); Execute();
running_ = false;
current_thread_tls_ = nullptr; current_thread_tls_ = nullptr;
xe::Profiler::ThreadExit(); xe::Profiler::ThreadExit();
@ -470,7 +472,6 @@ X_STATUS XThread::Terminate(int exit_code) {
void XThread::Execute() { void XThread::Execute() {
XELOGKERNEL("XThread::Execute thid %d (handle=%.8X, '%s', native=%.8X)", XELOGKERNEL("XThread::Execute thid %d (handle=%.8X, '%s', native=%.8X)",
thread_id_, handle(), name_.c_str(), thread_->system_id()); thread_id_, handle(), name_.c_str(), thread_->system_id());
running_ = true;
// Let the kernel know we are starting. // Let the kernel know we are starting.
kernel_state()->OnThreadExecute(this); kernel_state()->OnThreadExecute(this);
@ -504,7 +505,6 @@ void XThread::Execute() {
// Treat the return code as an implicit exit code. // Treat the return code as an implicit exit code.
} }
running_ = false;
Exit(exit_code); Exit(exit_code);
} }