You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
err('Pthread 0x'+_pthread_self().toString(16)+' called exit(), posting exitOnMainThread.');
91
+
#endif
92
+
// When running in a pthread we propagate the exit back to the main thread
93
+
// where it can decide if the whole process should be shut down or not.
94
+
// The pthread may have decided not to exit its own runtime, for example
95
+
// because it runs a main loop, but that doesn't affect the main thread.
96
+
exitOnMainThread(status);
97
+
throw'unwind';
98
+
}else{
99
+
#if PTHREADS_DEBUG
100
+
#if EXIT_RUNTIME
101
+
err('main thread called exit: keepRuntimeAlive='+keepRuntimeAlive()+' (counter='+runtimeKeepaliveCounter+')');
102
+
#else
103
+
err('main thread called exit: keepRuntimeAlive='+keepRuntimeAlive());
104
+
#endif
105
+
#endif
106
+
}
107
+
}
108
+
#endif
109
+
110
+
#if EXIT_RUNTIME
111
+
if(!keepRuntimeAlive()){
112
+
exitRuntime();
113
+
}
114
+
#endif
115
+
116
+
#if ASSERTIONS
117
+
// if exit() was called explicitly, warn the user if the runtime isn't actually being shut down
118
+
if(keepRuntimeAlive()&&!implicit){
119
+
#if !EXIT_RUNTIME
120
+
varmsg='program exited (with status: '+status+'), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)';
121
+
#else
122
+
varmsg='program exited (with status: '+status+'), but keepRuntimeAlive() is set (counter='+runtimeKeepaliveCounter+') due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)';
123
+
#endif // EXIT_RUNTIME
124
+
#if MODULARIZE
125
+
readyPromiseReject(msg);
126
+
#endif // MODULARIZE
127
+
err(msg);
128
+
}
129
+
#endif // ASSERTIONS
130
+
131
+
_proc_exit(status);
132
+
},
133
+
#endif
134
+
76
135
exit__sig: 'vi',
77
136
#if MINIMAL_RUNTIME
78
137
// minimal runtime doesn't do any exit cleanup handling so just
79
138
// map exit directly to the lower-level proc_exit syscall.
Copy file name to clipboardExpand all lines: src/postamble.js
+1-84Lines changed: 1 addition & 84 deletions
Original file line number
Diff line number
Diff line change
@@ -92,16 +92,6 @@ function runMemoryInitializer() {
92
92
93
93
varcalledRun;
94
94
95
-
/**
96
-
* @constructor
97
-
* @this {ExitStatus}
98
-
*/
99
-
functionExitStatus(status){
100
-
this.name="ExitStatus";
101
-
this.message="Program terminated with exit("+status+")";
102
-
this.status=status;
103
-
}
104
-
105
95
varcalledMain=false;
106
96
107
97
#if STANDALONE_WASM&&MAIN_READS_PARAMS
@@ -192,7 +182,7 @@ function callMain(args) {
192
182
#endif
193
183
#else
194
184
// if we're not running an evented main loop, it's time to exit
195
-
exit(ret,/* implicit = */true);
185
+
exitJS(ret,/* implicit = */true);
196
186
returnret;
197
187
}
198
188
catch(e){
@@ -408,79 +398,6 @@ function checkUnflushedContent() {
408
398
#endif // EXIT_RUNTIME
409
399
#endif // ASSERTIONS
410
400
411
-
/** @param {boolean|number=} implicit */
412
-
functionexit(status,implicit){
413
-
EXITSTATUS=status;
414
-
415
-
#if ASSERTIONS&&!EXIT_RUNTIME
416
-
checkUnflushedContent();
417
-
#endif // ASSERTIONS && !EXIT_RUNTIME
418
-
419
-
#if USE_PTHREADS
420
-
if(!implicit){
421
-
if(ENVIRONMENT_IS_PTHREAD){
422
-
#if PTHREADS_DEBUG
423
-
err('Pthread 0x'+_pthread_self().toString(16)+' called exit(), posting exitOnMainThread.');
424
-
#endif
425
-
// When running in a pthread we propagate the exit back to the main thread
426
-
// where it can decide if the whole process should be shut down or not.
427
-
// The pthread may have decided not to exit its own runtime, for example
428
-
// because it runs a main loop, but that doesn't affect the main thread.
429
-
exitOnMainThread(status);
430
-
throw'unwind';
431
-
}else{
432
-
#if PTHREADS_DEBUG
433
-
#if EXIT_RUNTIME
434
-
err('main thread called exit: keepRuntimeAlive='+keepRuntimeAlive()+' (counter='+runtimeKeepaliveCounter+')');
435
-
#else
436
-
err('main thread called exit: keepRuntimeAlive='+keepRuntimeAlive());
437
-
#endif
438
-
#endif
439
-
}
440
-
}
441
-
#endif
442
-
443
-
#if EXIT_RUNTIME
444
-
if(!keepRuntimeAlive()){
445
-
exitRuntime();
446
-
}
447
-
#endif
448
-
449
-
#if ASSERTIONS
450
-
// if exit() was called explicitly, warn the user if the runtime isn't actually being shut down
451
-
if(keepRuntimeAlive()&&!implicit){
452
-
#if !EXIT_RUNTIME
453
-
varmsg='program exited (with status: '+status+'), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)';
454
-
#else
455
-
varmsg='program exited (with status: '+status+'), but keepRuntimeAlive() is set (counter='+runtimeKeepaliveCounter+') due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)';
0 commit comments