make all threads preemptive. workaround file based emummc hanging due to fs r/w hanging the system.
the fix for file based emummc is to simply sleep between fs r/w to the sd card. the performance impact is minimal, even with the reduced buffer size. the above *only* applies for when using file based emummc. not affecting using partition or sysmmc.
This commit is contained in:
@@ -27,6 +27,9 @@
|
||||
namespace sphaira::ui::menu::game {
|
||||
namespace {
|
||||
|
||||
constexpr int THREAD_PRIO = PRIO_PREEMPTIVE;
|
||||
constexpr int THREAD_CORE = 1;
|
||||
|
||||
constexpr u32 ContentMetaTypeToContentFlag(u8 meta_type) {
|
||||
if (meta_type & 0x80) {
|
||||
return 1 << (meta_type - 0x80);
|
||||
@@ -649,9 +652,7 @@ void ThreadData::Run() {
|
||||
}
|
||||
|
||||
// sleep after every other entry loaded.
|
||||
if (i) {
|
||||
svcSleepThread(1e+6*2); // 2ms
|
||||
}
|
||||
svcSleepThread(2e+6); // 2ms
|
||||
|
||||
const auto result = LoadControlEntry(ids[i]);
|
||||
mutexLock(&m_mutex_result);
|
||||
@@ -875,7 +876,8 @@ Menu::Menu(u32 flags) : grid::Menu{"Games"_i18n, flags} {
|
||||
e.Open();
|
||||
}
|
||||
|
||||
threadCreate(&m_thread, ThreadFunc, &m_thread_data, nullptr, 1024*32, 0x30, 1);
|
||||
threadCreate(&m_thread, ThreadFunc, &m_thread_data, nullptr, 1024*32, THREAD_PRIO, THREAD_CORE);
|
||||
svcSetThreadCoreMask(m_thread.handle, THREAD_CORE, THREAD_AFFINITY_DEFAULT(THREAD_CORE));
|
||||
threadStart(&m_thread);
|
||||
}
|
||||
|
||||
|
||||
@@ -646,6 +646,7 @@ Result Menu::GcMount() {
|
||||
if (m_option_index == 2) {
|
||||
SetPop();
|
||||
} else {
|
||||
log_write("[GC] pressed A\n");
|
||||
if (!m_mounted) {
|
||||
return;
|
||||
}
|
||||
@@ -658,6 +659,7 @@ Result Menu::GcMount() {
|
||||
"OK"_i18n
|
||||
));
|
||||
} else {
|
||||
log_write("[GC] doing install A\n");
|
||||
App::Push(std::make_shared<ui::ProgressBox>(m_icon, "Installing "_i18n, m_entries[m_entry_index].lang_entry.name, [this](auto pbox) -> Result {
|
||||
auto source = std::make_shared<GcSource>(m_entries[m_entry_index], m_fs.get());
|
||||
return yati::InstallFromCollections(pbox, source, source->m_collections, source->m_config);
|
||||
|
||||
@@ -77,7 +77,7 @@ Menu::Menu(u32 flags) : MenuBase{"USB"_i18n, flags} {
|
||||
mutexInit(&m_mutex);
|
||||
|
||||
if (m_state != State::Failed) {
|
||||
threadCreate(&m_thread, thread_func, this, nullptr, 1024*32, 0x2C, 1);
|
||||
threadCreate(&m_thread, thread_func, this, nullptr, 1024*32, PRIO_PREEMPTIVE, 1);
|
||||
threadStart(&m_thread);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user