forked from boostorg/container
Fixes #148 again (Fix static initialization issues in pmr global resources)
This commit is contained in:
@@ -95,6 +95,10 @@ BOOST_CONTAINER_DECL memory_resource* get_default_resource() BOOST_NOEXCEPT
|
|||||||
//TO-DO: synchronizes-with part using atomics
|
//TO-DO: synchronizes-with part using atomics
|
||||||
if(dlmalloc_global_sync_lock()){
|
if(dlmalloc_global_sync_lock()){
|
||||||
memory_resource *current = default_memory_resource;
|
memory_resource *current = default_memory_resource;
|
||||||
|
if(!current){
|
||||||
|
//function called before main, default_memory resource was not initialied yet
|
||||||
|
current = new_delete_resource();
|
||||||
|
}
|
||||||
dlmalloc_global_sync_unlock();
|
dlmalloc_global_sync_unlock();
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user