Пример #1
0
//----------------------------------------
//	WaitAndShowTime
//----------------------------------------
Poco::Timestamp::TimeVal WaitAndShowTime(	ScopedLogMessage& msg
										,	Poco::Event& event
										,	Poco::Util::TimerTask::Ptr& pTask
										,	const std::string& text
										,	Poco::Timestamp::TimeVal refTime)
{
	event.wait();
	Poco::Timestamp::TimeVal val = pTask->lastExecution().epochMicroseconds();
	msg.Message(Poco::format("%s %7.3fmsec", text, 0.001*(val-refTime)));
	return val;
}
Пример #2
0
void CScanTool2Dlg::ReleaseThreads()
{
	//识别线程
	for (int i = 0; i < m_vecRecogThreadObj.size(); i++)
	{
		m_vecRecogThreadObj[i]->eExit.wait();
		m_pRecogThread[i].join();
	}
	std::vector<CRecognizeThread*>::iterator itRecogObj = m_vecRecogThreadObj.begin();
	for (; itRecogObj != m_vecRecogThreadObj.end();)
	{
		CRecognizeThread* pObj = *itRecogObj;
		SAFE_RELEASE(pObj);
		itRecogObj = m_vecRecogThreadObj.erase(itRecogObj);
	}
	if (m_pRecogThread)
	{
		delete[] m_pRecogThread;
		m_pRecogThread = NULL;
	}

	//文件发送线程
// 	m_SendFileThread->join();
// 	SAFE_RELEASE(m_pSendFileObj);
// 	g_eSendFileThreadExit.wait();
// 	SAFE_RELEASE(m_SendFileThread);

	//tcp命令线程
	m_TcpCmdThread->join();
	SAFE_RELEASE(m_pTcpCmdObj);
	g_eTcpThreadExit.wait();
	SAFE_RELEASE(m_TcpCmdThread);

	//压缩线程
	m_pCompressThread->join();
	SAFE_RELEASE(m_pCompressObj);
	g_eCompressThreadExit.wait();
	SAFE_RELEASE(m_pCompressThread);
}
Пример #3
0
//----------------------------------------
//	TestSchedule
//----------------------------------------
void TestSchedule(ScopedLogMessage& msg, Poco::Util::Timer& timer)
{
	msg.Message("--- schedule ---");

	const Poco::Timestamp::TimeDiff kTimeDiff = 500000;	// 500msec

	Poco::Event event;
	MyTimerTask task(msg, event);
	Poco::Util::TimerTask::Ptr pTask = new Poco::Util::TimerTaskAdapter<MyTimerTask>(task, &MyTimerTask::onTimer);

	Poco::Timestamp time;
	time += kTimeDiff;
	timer.schedule(pTask, time);
	
	event.wait();
	msg.Message(Poco::format("    execution delay from scheduled: %Ldusec"
							, pTask->lastExecution().epochMicroseconds()-time.epochMicroseconds()));
}
Пример #4
0
BOOL CScanTool2Dlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// 设置此对话框的图标。  当应用程序主窗口不是对话框时,框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标

	USES_CONVERSION;
	CString strTitle = _T("");
	strTitle.Format(_T("%s %s"), SYS_BASE_NAME, SOFT_VERSION);
	SetWindowText(strTitle);

	InitThreads();
	m_pExamInfoMgrDlg = new CExamInfoMgrDlg(this);
	m_pExamInfoMgrDlg->Create(CExamInfoMgrDlg::IDD, this);
	m_pExamInfoMgrDlg->ShowWindow(SW_SHOW);

	m_pScanMgrDlg = new CScanMgrDlg(this);
	m_pScanMgrDlg->Create(CScanMgrDlg::IDD, this);
	m_pScanMgrDlg->ShowWindow(SW_HIDE);

	try
	{
		g_eGetExamList.wait(5000);
	}
	catch (Poco::TimeoutException &e)
	{
	}
	InitUI();
	m_pExamInfoMgrDlg->InitShowData();
//	m_pExamInfoMgrDlg->Invalidate();

	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}