CThreadPool::CThreadPool(int nServiceType)
{
	m_nThreadSum				= 250;
	m_nThreadRunCount		= 0;

	m_ServiceType				= DogService4;
	m_bInit						= FALSE;
	m_bDebug					= FALSE;
	m_bLogger					= FALSE;
	m_bThreadPoolRun		= FALSE;
	m_bAddTaskRun			= FALSE;
	m_bEndPrint				= FALSE;
	m_bReadCfg				= FALSE;
	m_ServiceType				= nServiceType;
	m_strIniPath				= L"";
	m_strLogPath				= L"";	

	get_cfg_path();
	read_cfg();	
	get_log_path();

	m_hWaitingWork		= CreateEvent(NULL, false, false, NULL);
	m_hGotgWork			= CreateEvent(NULL, false, false, NULL);
	m_hAddTask			= CreateEvent(NULL, false, false, NULL);

	HANDLE hAddTask = (HANDLE)_beginthreadex(NULL, 0, _thr_add_task, this, 0, NULL);
	CloseHandle(hAddTask);
	HANDLE hReadCfg = (HANDLE)_beginthreadex(NULL, 0, _thr_read_config, this, 0, NULL);
	CloseHandle(hReadCfg);
	HANDLE hPrintState = (HANDLE)_beginthreadex(NULL, 0, _thr_print_state, this, 0, NULL);
	CloseHandle(hPrintState);
	
	init_thread_pool(m_nThreadSum);
}
Example #2
0
str 
okws_etcfile_required (const char *f, const char *env_var, bool d,
		       const char **cfg_path) 
{ 
  vec<str> v1;
  vec<const char *> v2;

  if (cfg_path == NULL)
    cfg_path = ok_cfg_path;

  get_cfg_path (&v1, env_var, cfg_path);
  vec2vec (&v2, v1);

  return sfsconst_etcfile_required (f, v2.base (), d);
}