Backported various little edits from Pro edition.
This commit is contained in:
parent
ef9938da0c
commit
4c9c6fa7ba
78 changed files with 2334 additions and 1266 deletions
15
lib/procs.h
15
lib/procs.h
|
@ -6,6 +6,8 @@
|
|||
#include <string>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include "tinythread.h"
|
||||
|
||||
/// Contains utility code, not directly related to streaming media
|
||||
namespace Util {
|
||||
|
@ -13,21 +15,30 @@ namespace Util {
|
|||
/// Deals with spawning, monitoring and stopping child processes
|
||||
class Procs {
|
||||
private:
|
||||
static std::set<pid_t> plist; ///< Holds active processes
|
||||
static bool childRunning(pid_t p);
|
||||
static tthread::mutex plistMutex;
|
||||
static tthread::thread * reaper_thread;
|
||||
static std::set<pid_t> plist; ///< Holds active process list.
|
||||
static bool handler_set; ///< If true, the sigchld handler has been setup.
|
||||
static bool thread_handler;///< True while thread handler should be running.
|
||||
static void childsig_handler(int signum);
|
||||
static void exit_handler();
|
||||
static void runCmd(std::string & cmd);
|
||||
static void setHandler();
|
||||
static char* const* dequeToArgv(std::deque<std::string> & argDeq);
|
||||
static void grim_reaper(void * n);
|
||||
public:
|
||||
static std::string getOutputOf(char * const * argv);
|
||||
static std::string getOutputOf(std::deque<std::string> & argDeq);
|
||||
static pid_t StartPiped(char * const * argv, int * fdin, int * fdout, int * fderr);
|
||||
static pid_t StartPiped(std::deque<std::string> & argDeq, int * fdin, int * fdout, int * fderr);
|
||||
static void Stop(pid_t name);
|
||||
static void Murder(pid_t name);
|
||||
static void StopAll();
|
||||
static int Count();
|
||||
static bool isActive(pid_t name);
|
||||
static bool isRunning(pid_t pid);
|
||||
static std::set<int> socketList; ///< Holds sockets that should be closed before forking
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue