diff --git a/src/library_pthread.js b/src/library_pthread.js index 6ff921d742fc5..7c5568e82e58f 100644 --- a/src/library_pthread.js +++ b/src/library_pthread.js @@ -275,11 +275,6 @@ var LibraryPThread = { err('Thread ' + d['threadId'] + ': ' + d['text']); } else if (cmd === 'alert') { alert('Thread ' + d['threadId'] + ': ' + d['text']); - } else if (cmd === 'detachedExit') { -#if ASSERTIONS - assert(worker.pthread); -#endif - PThread.returnWorkerToPool(worker); } else if (d.target === 'setimmediate') { // Worker wants to postMessage() to itself to implement setImmediate() // emulation. @@ -834,12 +829,6 @@ var LibraryPThread = { return 0; }, - __pthread_detached_exit: function() { - // Called at the end of pthread_exit (which occurs also when leaving the - // thread main function) if an only if the thread is in a detached state. - postMessage({ 'cmd': 'detachedExit' }); - }, - // Returns 0 on success, or one of the values -ETIMEDOUT, -EWOULDBLOCK or -EINVAL on error. emscripten_futex_wait__deps: ['emscripten_main_thread_process_queued_calls'], emscripten_futex_wait: function(addr, val, timeout) { diff --git a/system/lib/pthread/pthread_create.c b/system/lib/pthread/pthread_create.c index 6edd7da6346f4..1ec0b986b3642 100644 --- a/system/lib/pthread/pthread_create.c +++ b/system/lib/pthread/pthread_create.c @@ -25,7 +25,7 @@ extern int __pthread_create_js(struct pthread *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg); extern void _emscripten_thread_init(int, int, int); extern int _emscripten_default_pthread_stack_size(); -extern void __pthread_detached_exit(); +extern void __emscripten_thread_cleanup(pthread_t thread); extern void* _emscripten_tls_base(); extern int8_t __dso_handle; @@ -236,7 +236,7 @@ void _emscripten_thread_exit(void* result) { // object and we are done. if (state == DT_DETACHED) { self->detach_state = DT_EXITED; - __pthread_detached_exit(); + __emscripten_thread_cleanup(self); } else { self->detach_state = DT_EXITING; // wake any threads that might be waiting for us to exit diff --git a/system/lib/pthread/pthread_join.c b/system/lib/pthread/pthread_join.c index a8688ebac3ef0..f0c1e19a8c5dd 100644 --- a/system/lib/pthread/pthread_join.c +++ b/system/lib/pthread/pthread_join.c @@ -10,7 +10,7 @@ #include extern int __pthread_join_js(pthread_t t, void **res, int tryjoin); -extern int __emscripten_thread_cleanup(pthread_t t); +extern void __emscripten_thread_cleanup(pthread_t t); static int __pthread_join_internal(pthread_t t, void **res) { if (t->self != t) {