diff options
| author | Siva Chandra Reddy <sivachandra@google.com> | 2022-05-27 05:25:36 +0000 |
|---|---|---|
| committer | Siva Chandra Reddy <sivachandra@google.com> | 2022-06-01 17:36:58 +0000 |
| commit | ad89cf4e2d1ec47db094f33a436d6b7eab090a02 (patch) | |
| tree | aa73aeb80a5bf52754f0dfa3a63deae56c1ad2f3 /libc/src/threads | |
| parent | 62b448217595c33788693f4b682ea5a84d9e2005 (diff) | |
[libc] Keep all thread state information separate from the thread structure.
The state is now stored on the thread's stack memory. This enables
implementing pthread API like pthread_detach which takes the pthread_t
structure argument by value.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D126716
Diffstat (limited to 'libc/src/threads')
| -rw-r--r-- | libc/src/threads/thrd_join.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/libc/src/threads/thrd_join.cpp b/libc/src/threads/thrd_join.cpp index 20096a7be1bf..fbdfa78fec2b 100644 --- a/libc/src/threads/thrd_join.cpp +++ b/libc/src/threads/thrd_join.cpp @@ -19,12 +19,8 @@ static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread<int>), LLVM_LIBC_FUNCTION(int, thrd_join, (thrd_t * th, int *retval)) { auto *thread = reinterpret_cast<Thread<int> *>(th); - int result = thread->join(); - if (result == 0) { - *retval = thread->return_value(); - return thrd_success; - } - return thrd_error; + int result = thread->join(retval); + return result == 0 ? thrd_success : thrd_error; } } // namespace __llvm_libc |
