Merge branch 'development' into LTS_development

# Conflicts:
#	src/input/input.cpp
This commit is contained in:
Thulinma 2016-11-18 15:34:48 +01:00
commit 1fde08e333
7 changed files with 50 additions and 10 deletions

View file

@ -444,6 +444,18 @@ int Util::Procs::Count() {
/// Returns true if a process with this PID is currently active.
bool Util::Procs::isActive(pid_t name) {
tthread::lock_guard<tthread::mutex> guard(plistMutex);
return (plist.count(name) == 1) && (kill(name, 0) == 0);
return (kill(name, 0) == 0);
}
/// Forget about the given PID, keeping it running on shutdown.
void Util::Procs::forget(pid_t pid) {
tthread::lock_guard<tthread::mutex> guard(plistMutex);
plist.erase(pid);
}
/// Remember the given PID, killing it on shutdown.
void Util::Procs::remember(pid_t pid) {
tthread::lock_guard<tthread::mutex> guard(plistMutex);
plist.insert(pid);
}

View file

@ -38,6 +38,8 @@ namespace Util {
static int Count();
static bool isActive(pid_t name);
static bool isRunning(pid_t pid);
static void forget(pid_t pid);
static void remember(pid_t pid);
static std::set<int> socketList; ///< Holds sockets that should be closed before forking
};
}