|
STTNet
|
Static utility class for process management. More...
#include <sttnet_English.h>
Static Public Member Functions | |
| template<class... Args> | |
| static bool | startProcess (const std::string &name, const int &sec=-1, Args...args) |
| Start a new process (with the option to restart periodically) More... | |
| template<class Fn , class... Args> | |
| static std::enable_if <!std::is_convertible< Fn, std::string >::value, bool > ::type | startProcess (Fn &&fn, const int &sec=-1, Args &&...args) |
| Create a child process through a function (with the option to restart periodically) More... | |
Static utility class for process management.
|
inlinestatic |
Start a new process (with the option to restart periodically)
When sec == -1, the child process is started only once; otherwise, an auxiliary child process is created to restart the target process periodically.
| Args | Variable parameter types (used to pass to the target program's argv) |
| name | Path of the program to execute (e.g., /usr/bin/myapp) |
| sec | Time interval (in seconds). If -1, start only once without periodicity. |
| args | Startup parameters (the first parameter must be the program name, i.e., argv[0], no need to add nullptr at the end) |
|
inlinestatic |
Create a child process through a function (with the option to restart periodically)
Use a callable object (such as Lambda, function pointer, std::function) as the main logic of the new child process.
sec == -1, the function is executed only once;| Fn | Callable object type (such as function, Lambda) |
| Args | Parameter types for the callable object |
| fn | Function or callable object to execute |
| sec | Time interval (in seconds). If -1, execute only once without periodicity. |
| args | Parameters to pass to the function |
1.8.5