activetest.cpp

来自「很好用的网络封装库,不熟悉网络编程的人也可以使用。使用风格良好的标准c++编写。」· C++ 代码 · 共 45 行

CPP
45
字号
//
// ActiveTest.cpp
//
// $Id: //poco/1.3/CppUnit/WinTestRunner/src/ActiveTest.cpp#1 $
//


#include <afxwin.h>
#include "ActiveTest.h"


namespace CppUnit {


// Spawn a thread to a test
void ActiveTest::run(TestResult* result)
{
	CWinThread* thread;

	setTestResult(result);
	_runCompleted.ResetEvent();

	thread = AfxBeginThread(threadFunction, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
	DuplicateHandle(GetCurrentProcess(), thread->m_hThread, GetCurrentProcess(), &_threadHandle, 0, FALSE, DUPLICATE_SAME_ACCESS);

	thread->ResumeThread();
}


// Simple execution thread.  Assuming that an ActiveTest instance
// only creates one of these at a time.
UINT ActiveTest::threadFunction(LPVOID thisInstance)
{
    ActiveTest* test = (ActiveTest*) thisInstance;

    test->run();
    test->_runCompleted.SetEvent();

    return 0;
}


} // namespace CppUnit

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?