Skip to content

Commit

Permalink
Wait for other threads to finish compiling before exiting (#51213)
Browse files Browse the repository at this point in the history
This avoids a crashes where we run the destructors because C++ is fun
and runs destructors before thread exit.
  • Loading branch information
gbaraldi authored Sep 6, 2023
1 parent f9d1767 commit 3d88550
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9433,6 +9433,8 @@ extern "C" JL_DLLEXPORT_CODEGEN void jl_teardown_codegen_impl() JL_NOTSAFEPOINT
if (jl_ExecutionEngine)
jl_ExecutionEngine->printTimers();
PrintStatistics();
JL_LOCK(&jl_codegen_lock); // TODO: If this lock gets removed reconsider
// LLVM global state/destructors (maybe a rwlock)
}

// the rest of this file are convenience functions
Expand Down

0 comments on commit 3d88550

Please sign in to comment.