You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.1 KiB
59 lines
1.1 KiB
#ifndef __START_PROC_KERNEL_HEADER__
|
|
#define __START_PROC_KERNEL_HEADER__
|
|
|
|
#include "../../lib/components/base/basicSettingsProvider.h"
|
|
#include "../../lib/components/base/basicThread.h"
|
|
|
|
class SP_KERNEL;
|
|
|
|
#define SW_DEFAULT_TIMEOUT 180000 // 180 seconds
|
|
|
|
#define SW_TIMEOUT_PERCISION 100 // 0.1 second
|
|
#define INVALID_SOCKET -1
|
|
|
|
typedef struct S_WATCHDOG_PROC_REC
|
|
{
|
|
SP_KERNEL * master;
|
|
int client_socket;
|
|
uint64_t timeout;
|
|
bool finished;
|
|
pthread_t handler;
|
|
} WATCHDOG_PROC_REC;
|
|
|
|
typedef std::vector<WATCHDOG_PROC_REC *> WATCHDOG_PROCS_VECTOR;
|
|
|
|
class SP_KERNEL : public basicThread
|
|
{
|
|
protected:
|
|
|
|
virtual void m_fThreadProc(void);
|
|
|
|
public:
|
|
|
|
static SP_KERNEL * getInstance(bool ColdStart = true);
|
|
bool create(void);
|
|
|
|
int getExitCause()
|
|
{
|
|
return m_iExitCause;
|
|
}
|
|
|
|
void WaitFinish(bool force);
|
|
~SP_KERNEL();
|
|
|
|
private:
|
|
|
|
int m_iServerSocket;
|
|
int m_iExitCause;
|
|
WATCHDOG_PROCS_VECTOR m_vWPV;
|
|
|
|
static SP_KERNEL * _instance;
|
|
static void * sw_proc(void *);
|
|
void wd_shutdown(void);
|
|
SP_KERNEL();
|
|
basicLogCollection * m_pLog;
|
|
config_setting_t * m_pSettings;
|
|
char m_pUnixSocketName[PATH_MAX];
|
|
};
|
|
|
|
#endif
|