File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ void ThreadPool::initialize(size_t num) {
128128}
129129
130130size_t ThreadPool::getNumCores () {
131- #if EMSCRIPTEN
131+ #ifdef __EMSCRIPTEN__
132132 return 1 ;
133133#else
134134 size_t num = std::max (1U , std::thread::hardware_concurrency ());
@@ -181,7 +181,7 @@ void ThreadPool::work(std::vector<std::function<ThreadWorkState ()>>& doWorkers)
181181 }
182182 DEBUG_POOL (" main thread waiting\n " );
183183 condition.wait (lock, [this ]() { return areThreadsReady (); });
184- DEBUG_POOL (" main thread waiting\n " );
184+ DEBUG_POOL (" main thread done waiting\n " );
185185 DEBUG_POOL (" running = false\n " );
186186 running = false ;
187187 DEBUG_POOL (" work() is done\n " );
Original file line number Diff line number Diff line change @@ -71,7 +71,10 @@ class Fatal {
7171 }
7272 WASM_NORETURN ~Fatal () {
7373 std::cerr << " \n " ;
74- exit (1 );
74+ // Use _Exit here to avoid calling static destructors. This avoids deadlocks
75+ // in (for example) the thread worker pool, where workers hold a lock while
76+ // performing their work.
77+ _Exit (1 );
7578 }
7679};
7780
You can’t perform that action at this time.
0 commit comments