SIGSTOP any possible process ASAP

Shut down any UID matching process and resume if it turns out not to
be our target. Since we will record every single process we have ever
paused, this means that the same process will not be paused erroneously
for another time.

This is an optimization to hijack the app as soon as possible.
This commit is contained in:
topjohnwu
2019-03-02 04:24:41 -05:00
parent 7203e7df5c
commit d8cd2031c7
2 changed files with 23 additions and 20 deletions

View File

@@ -162,10 +162,12 @@ class RunFinally {
public:
explicit RunFinally(std::function<void()> &&fn): fn(std::move(fn)) {}
~RunFinally() { fn(); }
void disable() { fn = nullptr; }
~RunFinally() { if (fn) fn(); }
private:
const std::function<void ()> fn;
std::function<void ()> fn;
};
// file.cpp