mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-11-08 13:51:17 +01:00
ams.mitm: fix deadlock when building multiple romfs simultaneously (closes #1972)
This commit is contained in:
parent
081e76a2b5
commit
98bc030b37
@ -215,6 +215,9 @@ namespace ams::mitm::fs {
|
|||||||
using namespace ams::fs;
|
using namespace ams::fs;
|
||||||
|
|
||||||
std::shared_ptr<ams::fs::IStorage> GetLayeredRomfsStorage(ncm::ProgramId program_id, ::FsStorage &data_storage, bool is_process_romfs) {
|
std::shared_ptr<ams::fs::IStorage> GetLayeredRomfsStorage(ncm::ProgramId program_id, ::FsStorage &data_storage, bool is_process_romfs) {
|
||||||
|
/*Prepare to find or create a new storage. */
|
||||||
|
LayeredRomfsStorageImpl *impl = nullptr;
|
||||||
|
{
|
||||||
std::scoped_lock lk(g_storage_set_mutex);
|
std::scoped_lock lk(g_storage_set_mutex);
|
||||||
|
|
||||||
/* Find an existing storage. */
|
/* Find an existing storage. */
|
||||||
@ -238,7 +241,6 @@ namespace ams::mitm::fs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new storage. */
|
/* Create a new storage. */
|
||||||
LayeredRomfsStorageImpl *impl;
|
|
||||||
{
|
{
|
||||||
::FsFile data_file;
|
::FsFile data_file;
|
||||||
if (R_SUCCEEDED(OpenAtmosphereSdFile(std::addressof(data_file), program_id, "romfs.bin", OpenMode_Read))) {
|
if (R_SUCCEEDED(OpenAtmosphereSdFile(std::addressof(data_file), program_id, "romfs.bin", OpenMode_Read))) {
|
||||||
@ -250,8 +252,10 @@ namespace ams::mitm::fs {
|
|||||||
|
|
||||||
/* Insert holder. Reference count will now be one. */
|
/* Insert holder. Reference count will now be one. */
|
||||||
g_storage_set.insert(*(new LayeredRomfsStorageHolder(impl, is_process_romfs)));
|
g_storage_set.insert(*(new LayeredRomfsStorageHolder(impl, is_process_romfs)));
|
||||||
|
}
|
||||||
|
|
||||||
/* Begin initialization. When this finishes, a decref will occur. */
|
/* Begin initialization. When this finishes, a decref will occur. */
|
||||||
|
AMS_ABORT_UNLESS(impl != nullptr);
|
||||||
impl->BeginInitialize();
|
impl->BeginInitialize();
|
||||||
|
|
||||||
/* Return a new shared storage for the impl. */
|
/* Return a new shared storage for the impl. */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user