XThread set exit code on exit
This commit is contained in:
parent
c536053dec
commit
64089558f1
|
@ -321,7 +321,8 @@ X_STATUS XThread::Create() {
|
|||
|
||||
// Set the thread name based on host ID (for easier debugging)
|
||||
char thread_name[32];
|
||||
snprintf(thread_name, xe::countof(thread_name), "XThread%04X (%04X)", handle(), thread_->id());
|
||||
snprintf(thread_name, xe::countof(thread_name), "XThread%04X (%04X)",
|
||||
handle(), thread_->id());
|
||||
set_name(thread_name);
|
||||
|
||||
if (creation_params_.creation_flags & 0x60) {
|
||||
|
@ -340,8 +341,6 @@ X_STATUS XThread::Exit(int exit_code) {
|
|||
// This may only be called on the thread itself.
|
||||
assert_true(XThread::GetCurrentThread() == this);
|
||||
|
||||
// TODO(benvanik): set exit code in thread state block
|
||||
|
||||
// TODO(benvanik); dispatch events? waiters? etc?
|
||||
RundownAPCs();
|
||||
|
||||
|
@ -351,6 +350,11 @@ X_STATUS XThread::Exit(int exit_code) {
|
|||
current_thread_tls = nullptr;
|
||||
xe::Profiler::ThreadExit();
|
||||
|
||||
// Set exit code
|
||||
X_KTHREAD* thread = guest_object<X_KTHREAD>();
|
||||
thread->header.signal_state = 1;
|
||||
thread->exit_status = exit_code;
|
||||
|
||||
running_ = false;
|
||||
Release();
|
||||
ReleaseHandle();
|
||||
|
@ -363,6 +367,11 @@ X_STATUS XThread::Exit(int exit_code) {
|
|||
X_STATUS XThread::Terminate(int exit_code) {
|
||||
// TODO: Inform the profiler that this thread is exiting.
|
||||
|
||||
// Set exit code
|
||||
X_KTHREAD* thread = guest_object<X_KTHREAD>();
|
||||
thread->header.signal_state = 1;
|
||||
thread->exit_status = exit_code;
|
||||
|
||||
running_ = false;
|
||||
Release();
|
||||
ReleaseHandle();
|
||||
|
|
|
@ -82,14 +82,20 @@ struct X_KPCR {
|
|||
};
|
||||
|
||||
struct X_KTHREAD {
|
||||
X_DISPATCH_HEADER header; // 0x0
|
||||
char unk_10[0xAC]; // 0x10
|
||||
uint8_t suspend_count; // 0xBC
|
||||
char unk_BD[0x8F]; // 0xBD
|
||||
xe::be<uint32_t> thread_id; // 0x14C
|
||||
char unk_150[0x10]; // 0x150
|
||||
xe::be<uint32_t> last_error; // 0x160
|
||||
char unk_164[0x94C]; // 0x164
|
||||
X_DISPATCH_HEADER header; // 0x0
|
||||
char unk_10[0xAC]; // 0x10
|
||||
uint8_t suspend_count; // 0xBC
|
||||
uint8_t unk_BD; // 0xBD
|
||||
uint16_t unk_BE; // 0xBE
|
||||
char unk_C0[0x70]; // 0xC0
|
||||
xe::be<uint64_t> create_time; // 0x130
|
||||
xe::be<uint64_t> exit_time; // 0x138
|
||||
xe::be<uint32_t> exit_status; // 0x140
|
||||
char unk_144[0x8]; // 0x144
|
||||
xe::be<uint32_t> thread_id; // 0x14C
|
||||
char unk_150[0x10]; // 0x150
|
||||
xe::be<uint32_t> last_error; // 0x160
|
||||
char unk_164[0x94C]; // 0x164
|
||||
|
||||
// This struct is actually quite long... so uh, not filling this out!
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue