Skip to content

Commit 405e1a4

Browse files
gbaraldiKristofferC
authored andcommitted
Wait for other threads to finish compiling before exiting (#51213)
This avoids a crashes where we run the destructors because C++ is fun and runs destructors before thread exit. (cherry picked from commit 3d88550)
1 parent 6f864a7 commit 405e1a4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/codegen.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9294,6 +9294,8 @@ extern "C" JL_DLLEXPORT_CODEGEN void jl_teardown_codegen_impl() JL_NOTSAFEPOINT
92949294
if (jl_ExecutionEngine)
92959295
jl_ExecutionEngine->printTimers();
92969296
PrintStatistics();
9297+
JL_LOCK(&jl_codegen_lock); // TODO: If this lock gets removed reconsider
9298+
// LLVM global state/destructors (maybe a rwlock)
92979299
}
92989300

92999301
// the rest of this file are convenience functions

0 commit comments

Comments
 (0)