| 947 | } |
| 948 | |
| 949 | ProcessRunner::Results |
| 950 | ProcessRunner::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 | |
| 988 | void ProcessRunner::withLock(std::function<void(UILocker::Session&)> f) |
| 989 | { |
no test coverage detected