mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 09:12:28 +02:00
initial import
This commit is contained in:
44
CppUnit/WinTestRunner/src/ActiveTest.cpp
Normal file
44
CppUnit/WinTestRunner/src/ActiveTest.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// ActiveTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.1.0/CppUnit/WinTestRunner/src/ActiveTest.cpp#1 $
|
||||
//
|
||||
|
||||
|
||||
#include <afxwin.h>
|
||||
#include "ActiveTest.h"
|
||||
|
||||
|
||||
CppUnit_BEGIN
|
||||
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
CppUnit_END
|
||||
|
||||
Reference in New Issue
Block a user