perl: ensure that stores are destroyed after aio roots
otherwise stores containing async objects will cause crashes during shutdown. currently there are no such stores, but that will change. Change-Id: I05d46ba6831c641774edfe6aa99aa7d0de457429
This commit is contained in:
@@ -34,11 +34,15 @@ static AsyncIoRoot & aio()
|
||||
|
||||
static ref<Store> store()
|
||||
{
|
||||
static std::optional<ref<Store>> _store;
|
||||
auto & aioRoot = aio();
|
||||
|
||||
// SAFETY: this store will be destructed after its associated aio
|
||||
// root because the root is initialized first (due to call above)
|
||||
static thread_local std::optional<ref<Store>> _store;
|
||||
if (!_store) {
|
||||
try {
|
||||
initLibStore();
|
||||
_store = aio().blockOn(openStore());
|
||||
_store = aioRoot.blockOn(openStore());
|
||||
} catch (Error & e) {
|
||||
croak("%s", e.what());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user