MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / waitForAllUSVFSProcessesWithLock

Method waitForAllUSVFSProcessesWithLock

src/processrunner.cpp:949–986  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

947}
948
949ProcessRunner::Results
950ProcessRunner::waitForAllUSVFSProcessesWithLock(UILocker::Reasons reason)
951{
952 m_lockReason = reason;
953
954 if (!m_core.settings().interface().lockGUI()) {
955 // disabling locking is like clicking on unlock immediately
956 return ForceUnlocked;
957 }
958
959 auto r = Error;
960
961 for (;;) {
962 withLock([&](auto& ls) {
963 const auto processes = getRunningUSVFSProcesses();
964 if (processes.empty()) {
965 r = Completed;
966 return;
967 }
968
969 r = waitForProcesses(processes, &ls);
970
971 if (r != Completed) {
972 // error, cancelled, or unlocked
973 return;
974 }
975
976 // this process is completed, check for others
977 r = Running;
978 });
979
980 if (r != Running) {
981 break;
982 }
983 }
984
985 return r;
986}
987
988void ProcessRunner::withLock(std::function<void(UILocker::Session&)> f)
989{

Callers 1

Calls 5

getRunningUSVFSProcessesFunction · 0.85
waitForProcessesFunction · 0.85
lockGUIMethod · 0.80
settingsMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected