Add process termination registration

Edited patch because of context change due to:
commit 28548f35b0
Author: Thulinma <jaron@vietors.com>
Date:   Tue Aug 14 20:53:05 2012 +0200

    Do not report part-termination of processes.
This commit is contained in:
Peter Wu 2012-08-15 11:40:53 +02:00
parent 3f089117c7
commit 06167128bf
2 changed files with 42 additions and 1 deletions

View file

@ -9,10 +9,13 @@
/// Contains utility code, not directly related to streaming media
namespace Util{
typedef void (*TerminationNotifier)(pid_t pid, int exitCode);
/// Deals with spawning, monitoring and stopping child processes
class Procs{
private:
static std::map<pid_t, std::string> plist; ///< Holds active processes
static std::map<pid_t, TerminationNotifier> exitHandlers; ///< termination function, if any
static bool handler_set; ///< If true, the sigchld handler has been setup.
static void childsig_handler(int signum);
static void runCmd(std::string & cmd);
@ -28,6 +31,7 @@ namespace Util{
static bool isActive(pid_t name);
static pid_t getPid(std::string name);
static std::string getName(pid_t name);
static bool SetTerminationNotifier(pid_t pid, TerminationNotifier notifier);
};
};