base
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
/***************************************************************************
|
||||
Job Manager
|
||||
-----------------------------------------
|
||||
begin : 2012/05/14
|
||||
copyright : (C) 2011 SolutionBox Inc.
|
||||
author : Service 1 Team
|
||||
email : svc1@solbox.com
|
||||
version : 3.1.0
|
||||
|
||||
CopyRight(C) 2011 SolutionBox Inc. All Rights reserved.
|
||||
Redistribution and use in source and binary forms, with or with out
|
||||
modification, are not permitted in outside of SolutionBox Inc.
|
||||
***************************************************************************/
|
||||
#ifndef __JOBMANAGER_H__
|
||||
#define __JOBMANAGER_H__
|
||||
|
||||
class CSourceData;
|
||||
|
||||
class jobmanager
|
||||
{
|
||||
public:
|
||||
jobmanager(JOB_TYPE::JOB_TYPE type, const char* syncpath);
|
||||
~jobmanager();
|
||||
|
||||
int run();
|
||||
|
||||
bool runsync();
|
||||
|
||||
pthread_t getjobhandle() {return m_hthread;}
|
||||
|
||||
void setexit(bool v) { m_exit = v; }
|
||||
bool isexit() { return m_exit; }
|
||||
void setsyncfilename(const char* path) {m_tmppath.m_syncpath = path; }
|
||||
string getsyncfilenmae() { return m_tmppath.m_syncpath; }
|
||||
|
||||
int worknotify(short success);
|
||||
|
||||
void printstatus(string prefixed = "");
|
||||
|
||||
private:
|
||||
static void* WorkFn(void* pdata);
|
||||
static void cleanup(void* pdata);
|
||||
|
||||
void cleandata();
|
||||
|
||||
bool gettargethostlist(string path, vector<string> &vechost);
|
||||
bool waiting();
|
||||
|
||||
int64_t getfileline(const char* path);
|
||||
|
||||
private:
|
||||
//*
|
||||
class tmpdataspath
|
||||
{
|
||||
public:
|
||||
string m_syncpath;
|
||||
};
|
||||
|
||||
class jobstatus
|
||||
{
|
||||
public:
|
||||
jobstatus()
|
||||
: m_diff(0), m_work(0), m_launcherfail(0), m_success(0),m_error(0) {}
|
||||
public:
|
||||
int64_t m_diff;
|
||||
int64_t m_work;
|
||||
int64_t m_launcherfail;
|
||||
int64_t m_success;
|
||||
int64_t m_error;
|
||||
};
|
||||
|
||||
JOB_TYPE::JOB_TYPE m_type;
|
||||
tmpdataspath m_tmppath;
|
||||
jobstatus m_status;
|
||||
|
||||
bool m_exit;
|
||||
|
||||
pthread_t m_hthread;
|
||||
vector<CSourceData*> m_srcdata;
|
||||
|
||||
pthread_mutex_t m_notifymutex;
|
||||
};
|
||||
|
||||
#endif // __JOBMANAGER_H__
|
||||
Reference in New Issue
Block a user