Skip to content

Commit 5e65f91

Browse files
committed
Incorporate review comments
1 parent 5eade80 commit 5e65f91

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

system/lib/libc/musl/src/thread/pthread_detach.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
static int __pthread_detach(pthread_t t)
55
{
6-
#ifdef __EMSCRIPTEN__
76
// XXX EMSCRIPTEN: Add check for invalid (already joined) thread. Again
87
// for the benefit of the conformance tests.
9-
if (t->self != t) return ESRCH;
10-
#endif
8+
if (t->self != t)
9+
return ESRCH;
1110
/* If the cas fails, detach state is either already-detached
1211
* or exiting/exited, and pthread_join will trap or cleanup. */
1312
if (a_cas(&t->detach_state, DT_JOINABLE, DT_DETACHED) != DT_JOINABLE)
@@ -17,6 +16,5 @@ static int __pthread_detach(pthread_t t)
1716

1817
weak_alias(__pthread_detach, pthread_detach);
1918
weak_alias(__pthread_detach, thrd_detach);
20-
#ifdef __EMSCRIPTEN__ // XXX Emscripten add an extra alias for ASan/LSan.
19+
// XXX EMSCRIPTEN: add extra alias for asan.
2120
weak_alias(__pthread_detach, emscripten_builtin_pthread_detach);
22-
#endif

system/lib/libc/musl/src/thread/pthread_join.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ static int __pthread_timedjoin_np(pthread_t t, void **res, const struct timespec
1919
if (t->self != t) return ESRCH;
2020
// Thread is attempting to join to itself. Already detached threads are
2121
// handled below by returning EINVAL instead.
22+
// TODO: The detached check here is just to satisfy the `other.test_{proxy,main}_pthread_join_detach` tests.
2223
if (t->detach_state != DT_DETACHED && __pthread_self() == t) return EDEADLK;
2324
#endif
2425
int state, cs, r = 0;

tests/pthread/main_thread_join.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void *ThreadMain(void *arg) {
3333
// succeeding.
3434
while (tries.load() < EXPECTED_TRIES) {}
3535
#endif
36-
pthread_exit((void*)0);
36+
pthread_exit((void*)0);
3737
}
3838

3939
pthread_t CreateThread() {

0 commit comments

Comments
 (0)