Skip to content

Commit 0b0d88b

Browse files
committed
Incorporate review comments
1 parent 47e0a68 commit 0b0d88b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/library_pthread.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ var LibraryPThread = {
409409

410410
__emscripten_thread_cleanup: function(thread) {
411411
// Called when a thread needs to be cleaned up so it can be reused.
412+
// A thread is considered reusable when it either returns from its
413+
// entry point, calls pthread_exit, or acts upon a cancellation.
414+
// Detached threads are responsible for calling this themselves,
415+
// otherwise pthread_join is responsible for calling this.
412416
if (!ENVIRONMENT_IS_PTHREAD) cleanupThread(thread);
413417
else postMessage({ 'cmd': 'cleanupThread', 'thread': thread });
414418
},

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "pthread_impl.h"
44
#include "syscall.h"
55

6+
#ifndef __EMSCRIPTEN__
67
hidden long __cancel(), __syscall_cp_asm(), __syscall_cp_c();
78

89
long __cancel()
@@ -14,7 +15,6 @@ long __cancel()
1415
return -ECANCELED;
1516
}
1617

17-
#ifndef __EMSCRIPTEN__
1818
long __syscall_cp_asm(volatile void *, syscall_arg_t,
1919
syscall_arg_t, syscall_arg_t, syscall_arg_t,
2020
syscall_arg_t, syscall_arg_t, syscall_arg_t);
@@ -67,7 +67,6 @@ static void cancel_handler(int sig, siginfo_t *si, void *ctx)
6767

6868
__syscall(SYS_tkill, self->tid, SIGCANCEL);
6969
}
70-
#endif
7170

7271
void __testcancel()
7372
{
@@ -76,7 +75,6 @@ void __testcancel()
7675
__cancel();
7776
}
7877

79-
#ifndef __EMSCRIPTEN__
8078
static void init_cancellation()
8179
{
8280
struct sigaction sa = {

0 commit comments

Comments
 (0)