// destroy the thread data and the thread itself
void CleanUpThreadData();
+ // number of times EnableAutoCheckOnlineStatus() had been called minus the
+ // number of times DisableAutoCheckOnlineStatus() had been called
+ int m_autoCheckLevel;
+
// timer used for polling RAS status
class WXDLLEXPORT RasTimer : public wxTimer
{
m_dllRas(_T("RASAPI32"))
{
// initialize our data
+ m_autoCheckLevel = 0;
m_hThread = 0;
if ( !m_dllRas.IsLoaded() )
{
wxCHECK_MSG( IsOk(), FALSE, wxT("using uninitialized wxDialUpManager") );
+ if ( m_autoCheckLevel++ )
+ {
+ // already checking
+ return TRUE;
+ }
+
bool ok = ms_pfnRasConnectionNotification != 0;
if ( ok )
// first, see if we don't have this thread already running
if ( m_hThread != 0 )
{
- DWORD dwSuspendCount = 2;
- while ( dwSuspendCount > 1 )
- {
- dwSuspendCount = ResumeThread(m_hThread);
- if ( dwSuspendCount == (DWORD)-1 )
- {
- wxLogLastError(wxT("ResumeThread(RasThread)"));
+ if ( ::ResumeThread(m_hThread) != (DWORD)-1 )
+ return TRUE;
- ok = FALSE;
- }
- }
+ // we're leaving a zombie thread... but what else can we do?
+ wxLogLastError(wxT("ResumeThread(RasThread)"));
- if ( ok )
- {
- return TRUE;
- }
+ ok = FALSE;
}
}
{
wxCHECK_RET( IsOk(), wxT("using uninitialized wxDialUpManager") );
+ if ( --m_autoCheckLevel )
+ {
+ // still checking
+ return;
+ }
+
if ( m_hThread )
{
// we have running secondary thread, it's just enough to suspend it