diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-05-07 20:55:07 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-05-07 20:55:07 +0000 |
| commit | 2159f78d59e9cedede0ef5b51d4f37dd1b3489b9 (patch) | |
| tree | ae1221db5b6ed1891890f77e06f18dc5d4215cdc /src/msvc6/testrunner/ActiveTest.cpp | |
| parent | 8167f9cbc23ba04493a4356e597e46424f1756b1 (diff) | |
| download | cppunit-2159f78d59e9cedede0ef5b51d4f37dd1b3489b9.tar.gz | |
Src/DllPlugInTester/CommandLineParser.
src/DllPlugInTester/CommandLineParser.cpp: fixed compilation issue.
* src/msvc6/TestRunner/ActiveTest.h:
* src/msvc6/TestRunner/ActiveTest.cpp: reindented. bugfix: thread handle
resource leak (bug #553424).
Diffstat (limited to 'src/msvc6/testrunner/ActiveTest.cpp')
| -rw-r--r-- | src/msvc6/testrunner/ActiveTest.cpp | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/src/msvc6/testrunner/ActiveTest.cpp b/src/msvc6/testrunner/ActiveTest.cpp index aac4015..91eab6d 100644 --- a/src/msvc6/testrunner/ActiveTest.cpp +++ b/src/msvc6/testrunner/ActiveTest.cpp @@ -1,45 +1,48 @@ - - #include "stdafx.h" #include "ActiveTest.h" // Spawn a thread to a test -void ActiveTest::run (CppUnit::TestResult *result) +void +ActiveTest::run( CppUnit::TestResult *result ) { - CWinThread *thread; - - setTestResult (result); - m_runCompleted.ResetEvent (); - - thread = AfxBeginThread (threadFunction, - this, - THREAD_PRIORITY_NORMAL, - 0, - CREATE_SUSPENDED); - - DuplicateHandle (GetCurrentProcess (), - thread->m_hThread, - GetCurrentProcess (), - &m_threadHandle, - 0, - FALSE, - DUPLICATE_SAME_ACCESS); - - thread->ResumeThread (); - + CWinThread *thread; + + setTestResult( result ); + m_runCompleted.ResetEvent(); + + thread = ::AfxBeginThread( threadFunction, + this, + THREAD_PRIORITY_NORMAL, + 0, + CREATE_SUSPENDED); + + ::DuplicateHandle( GetCurrentProcess(), + thread->m_hThread, + GetCurrentProcess(), + &m_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) +UINT +ActiveTest::threadFunction( LPVOID thisInstance ) { - ActiveTest *test = (ActiveTest *)thisInstance; + ActiveTest *test = (ActiveTest *)thisInstance; + + test->run (); + + ::CloseHandle( test->m_threadHandle ); + test->m_threadHandle = INVALID_HANDLE_VALUE - test->run (); - test->m_runCompleted.SetEvent (); + test->m_runCompleted.SetEvent(); - return 0; + return 0; } |
