Use existing `result` rather than adding to pthread struct. NFC (#14850)

diff --git a/src/library_pthread.js b/src/library_pthread.js
index 2c0fb2d..ff97026 100644
--- a/src/library_pthread.js
+++ b/src/library_pthread.js
@@ -853,10 +853,12 @@
     for (;;) {
       var threadStatus = Atomics.load(HEAPU32, (thread + {{{ C_STRUCTS.pthread.threadStatus }}} ) >> 2);
       if (threadStatus == 1) { // Exited?
-        var threadExitCode = Atomics.load(HEAPU32, (thread + {{{ C_STRUCTS.pthread.threadExitCode }}} ) >> 2);
-        if (status) {{{ makeSetValue('status', 0, 'threadExitCode', 'i32') }}};
-        Atomics.store(HEAPU32, (thread + {{{ C_STRUCTS.pthread.detached }}} ) >> 2, 1); // Mark the thread as detached.
-
+        if (status) {
+          var result = Atomics.load(HEAPU32, (thread + {{{ C_STRUCTS.pthread.result }}} ) >> 2);
+          {{{ makeSetValue('status', 0, 'result', 'i32') }}};
+        }
+        // Mark the thread as detached.
+        Atomics.store(HEAPU32, (thread + {{{ C_STRUCTS.pthread.detached }}} ) >> 2, 1);
         if (!ENVIRONMENT_IS_PTHREAD) cleanupThread(thread);
         else postMessage({ 'cmd': 'cleanupThread', 'thread': thread });
         return 0;
@@ -970,7 +972,7 @@
     Atomics.store(HEAPU32, (tb + {{{ C_STRUCTS.pthread.cancelasync }}} ) >> 2, 0/*PTHREAD_CANCEL_DEFERRED*/);
     PThread.runExitHandlers();
 
-    Atomics.store(HEAPU32, (tb + {{{ C_STRUCTS.pthread.threadExitCode }}} ) >> 2, status);
+    Atomics.store(HEAPU32, (tb + {{{ C_STRUCTS.pthread.result }}} ) >> 2, status);
     // When we publish this, the main thread is free to deallocate the thread object and we are done.
     // Therefore set _pthread_self = 0; above to 'release' the object in this worker thread.
     Atomics.store(HEAPU32, (tb + {{{ C_STRUCTS.pthread.threadStatus }}} ) >> 2, 1); // Mark the thread as no longer running.
diff --git a/src/struct_info_internal.json b/src/struct_info_internal.json
index 39b4280..c0a0f2c 100644
--- a/src/struct_info_internal.json
+++ b/src/struct_info_internal.json
@@ -7,13 +7,13 @@
         "structs": {
             "pthread": [
               "threadStatus",
-              "threadExitCode",
               "profilerBlock",
               "self",
               "tsd",
               "detached",
               "stack",
               "stack_size",
+              "result",
               "attr",
               "robust_list",
               "tid",
diff --git a/system/lib/libc/musl/src/internal/pthread_impl.h b/system/lib/libc/musl/src/internal/pthread_impl.h
index 05e2d13..b37a3c8 100644
--- a/system/lib/libc/musl/src/internal/pthread_impl.h
+++ b/system/lib/libc/musl/src/internal/pthread_impl.h
@@ -37,7 +37,6 @@
 	// Note: The specific order of these fields is important, since these are accessed
 	// by direct pointer arithmetic in worker.js.
 	int threadStatus; // 0: thread not exited, 1: exited.
-	int threadExitCode; // Thread exit code.
 	thread_profiler_block * _Atomic profilerBlock; // If --threadprofiler is enabled, this pointer is allocated to contain internal information about the thread state for profiling purposes.
 #endif
 
diff --git a/tests/reference_struct_info.json b/tests/reference_struct_info.json
index dcff610..372173c 100644
--- a/tests/reference_struct_info.json
+++ b/tests/reference_struct_info.json
@@ -1405,21 +1405,21 @@
             "p_proto": 8
         },
         "pthread": {
-            "__size__": 228,
-            "attr": 104,
-            "cancelasync": 60,
-            "canceldisable": 56,
-            "detached": 64,
-            "locale": 172,
-            "profilerBlock": 8,
-            "robust_list": 152,
-            "self": 12,
-            "stack": 76,
-            "stack_size": 80,
-            "threadExitCode": 4,
+            "__size__": 224,
+            "attr": 100,
+            "cancelasync": 56,
+            "canceldisable": 52,
+            "detached": 60,
+            "locale": 168,
+            "profilerBlock": 4,
+            "result": 88,
+            "robust_list": 148,
+            "self": 8,
+            "stack": 72,
+            "stack_size": 76,
             "threadStatus": 0,
-            "tid": 40,
-            "tsd": 100
+            "tid": 36,
+            "tsd": 96
         },
         "rlimit": {
             "__size__": 16,