@@ -94,8 +94,6 @@ var LibraryPThread = {
9494#endif
9595 if ( { { { ENVIRONMENT_IS_MAIN_THREAD ( ) } } } ) {
9696 PThread . initMainThread ( ) ;
97- } else {
98- PThread . initWorker ( ) ;
9997 }
10098 } ,
10199 initMainThread ( ) {
@@ -122,19 +120,6 @@ var LibraryPThread = {
122120#endif
123121 } ,
124122
125- initWorker ( ) {
126- #if isSymbolNeeded ( '$noExitRuntime' )
127- // The default behaviour for pthreads is always to exit once they return
128- // from their entry point (or call pthread_exit). If we set noExitRuntime
129- // to true here on pthreads they would never complete and attempt to
130- // pthread_join to them would block forever.
131- // pthreads can still choose to set `noExitRuntime` explicitly, or
132- // call emscripten_unwind_to_js_event_loop to extend their lifetime beyond
133- // their main function. See comment in src/runtime_pthread.js for more.
134- noExitRuntime = false ;
135- #endif
136- } ,
137-
138123#if PTHREADS_PROFILING
139124 getThreadName ( pthreadPtr ) {
140125 var profilerBlock = { { { makeGetValue ( 'pthreadPtr' , C_STRUCTS . pthread . profilerBlock , '*' ) } } } ;
@@ -1066,6 +1051,16 @@ var LibraryPThread = {
10661051 // ` runtimeKeepaliveCounter ` to zero. Reset it now so the new thread won't
10671052 // be affected.
10681053 runtimeKeepaliveCounter = 0;
1054+
1055+ #if isSymbolNeeded('$noExitRuntime')
1056+ // Same for noExitRuntime. The default for pthreads should always be false
1057+ // otherwise pthreads would never complete and attempts to pthread_join to
1058+ // them would block forever.
1059+ // pthreads can still choose to set ` noExitRuntime ` explicitly, or
1060+ // call emscripten_unwind_to_js_event_loop to extend their lifetime beyond
1061+ // their main function. See comment in src/runtime_pthread.js for more.
1062+ noExitRuntime = 0;
1063+ #endif
10691064#endif
10701065
10711066#if MAIN_MODULE
0 commit comments