dynstage: fix data race with async logging system

This commit is contained in:
Andrei Alexeyev 2022-11-04 16:23:40 +01:00
parent 8fe2cde9e6
commit f5e8cfe65e
No known key found for this signature in database
GPG key ID: 72D26128040B9690

View file

@ -294,6 +294,10 @@ uint32_t dynstage_get_generation(void) {
bool dynstage_reload_library(void) {
if(dynstage.lib) {
// In-flight async log messages may still have pointers to static strings inside the old lib
// Wait for them to finish processing so it's safe to unload
log_sync();
dlclose(dynstage.lib);
}