virtual void OnExit()
    {
        if ( gs_heventShutdown.IsOk() )
        {
            // stop any threads waiting for the termination of asynchronously
            // running processes
            if ( !gs_heventShutdown.Set() )
            {
                wxLogDebug(wxT("Failed to set shutdown event in wxExecuteModule"));
            }

            gs_heventShutdown.Close();

            // now wait until they terminate
            if ( !gs_asyncThreads.empty() )
            {
                const size_t numThreads = gs_asyncThreads.size();

                if ( ::WaitForMultipleObjects
                       (
                        numThreads,
                        &gs_asyncThreads[0],
                        TRUE,   // wait for all of them to become signalled
                        3000    // long but finite value
                       ) == WAIT_TIMEOUT )
                {
                    wxLogDebug(wxT("Failed to stop all wxExecute monitor threads"));
                }

#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
                for ( size_t n = 0; n < numThreads; n++ )
                {
                    ::CloseHandle(gs_asyncThreads[n]);
                }

                gs_asyncThreads.clear();
            }
        }

        if ( gs_classForHiddenWindow )
        {
            if ( !::UnregisterClass(wxMSWEXEC_WNDCLASSNAME, wxGetInstance()) )
            {
                wxLogLastError(wxT("UnregisterClass(wxExecClass)"));
            }

            gs_classForHiddenWindow = NULL;
        }
    }
Beispiel #2
0
void MyClient::StartNextTestIfNecessary()
{
    while ( !m_tests.empty() )
    {
        MyClientTestFunc testfunc = m_tests.front();
        m_tests.erase(m_tests.begin());
        (this->*testfunc)();
    }
}
Beispiel #3
0
    virtual void OnExit()
    {
        if ( gs_heventShutdown )
        {
            // stop any threads waiting for the termination of asynchronously
            // running processes
            if ( !::SetEvent(gs_heventShutdown) )
            {
                wxLogDebug(wxT("Failed to set shutdown event in wxExecuteModule"));
            }

            ::CloseHandle(gs_heventShutdown);
            gs_heventShutdown = NULL;

            // now wait until they terminate
            if ( !gs_asyncThreads.empty() )
            {
                const size_t numThreads = gs_asyncThreads.size();

                if ( ::WaitForMultipleObjects
                        (
                            numThreads,
                            &gs_asyncThreads[0],
                            TRUE,   // wait for all of them to become signalled
                            3000    // long but finite value
                        ) == WAIT_TIMEOUT )
                {
                    wxLogDebug(wxT("Failed to stop all wxExecute monitor threads"));
                }

                for ( size_t n = 0; n < numThreads; n++ )
                {
                    ::CloseHandle(gs_asyncThreads[n]);
                }

                gs_asyncThreads.clear();
            }
        }

        if ( gs_classForHiddenWindow )
        {
            if ( !::UnregisterClass(wxMSWEXEC_WNDCLASSNAME, wxGetInstance()) )
            {
                wxLogLastError(wxT("UnregisterClass(wxExecClass)"));
            }

            gs_classForHiddenWindow = NULL;
        }
    }