Skip to content

Commit

Permalink
Add option StartupSleepProcName
Browse files Browse the repository at this point in the history
Sleeps only if current process matches this name. Leave empty to sleep
StartupSleep seconds on all processes.
  • Loading branch information
pmatos committed Jan 30, 2025
1 parent b148cc6 commit 28170fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions FEXCore/Source/Interface/Config/Config.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,13 @@
"Sleeps the process at startup for a duration of seconds.",
"Useful if an application crashes too quickly to attach a debugger."
]
},
"StartupSleepProcName": {
"Type": "str",
"Default": "",
"Desc": [
"Contrains the startup sleep to only apply to processes that match this name."
]
}
},
"Misc": {
Expand Down
3 changes: 2 additions & 1 deletion Source/Tools/FEXLoader/FEXLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ int main(int argc, char** argv, char** const envp) {
// Doesn't use CONFIG_ROOTFS and we don't want it to spin up a squashfs instance
FEX_CONFIG_OPT(StallProcess, STALLPROCESS);
FEX_CONFIG_OPT(StartupSleep, STARTUPSLEEP);
FEX_CONFIG_OPT(StartupSleepProcName, STARTUPSLEEPPROCNAME);
if (StallProcess) {
while (1) {
// Stall this process out forever
Expand Down Expand Up @@ -409,7 +410,7 @@ int main(int argc, char** argv, char** const envp) {
}
}

if (StartupSleep()) {
if (StartupSleep() && (StartupSleepProcName().empty() || Program.ProgramName == StartupSleepProcName())) {
LogMan::Msg::IFmt("[{}][{}] Sleeping for {} seconds", ::getpid(), Program.ProgramName, StartupSleep());
std::this_thread::sleep_for(std::chrono::seconds(StartupSleep()));
}
Expand Down

0 comments on commit 28170fd

Please sign in to comment.