MultiStreamIOServer::~MultiStreamIOServer( void ) { // First get _ioThread to terminate, if it's still active if( IsActiveThread( _ioThread ) ) { while( 1 ) { // As long as the server has work to do, it cannot be terminated. #if DEBUG_MUTEX EnterCriticalSection( &_clientLock , 100 , "MultiStreamIOServer::~MultiStreamIOServer" ); #else // !DEBUG_MUTEX EnterCriticalSection( &_clientLock ); #endif // DEBUG_MUTEX if( !_clients.size() ) { // [WARNING] Dead-lock potential. Trying to interrupt while holding onto _clientLock. // _IOThread may block waiting for the lock before reaching the interrupt point. _allowNewClients = false; LeaveCriticalSection( &_clientLock ); if( !InterruptThread( _ioThread ) ) fprintf( stderr , "[WARNING] MultiStreamIOServer::~MultiStreamIOServer: Failed to interrupt MultiStreamIOServer thread\n" ); break; } LeaveCriticalSection( &_clientLock ); } } DeleteCriticalSection( &_pendingLock ); DeleteCriticalSection( &_clientLock ); }
BOOL PDD_ISR(PDWORD pdwWaitTime) { UNREFERENCED_PARAMETER(pdwWaitTime); InterruptThread( g_pddInterface.pvPddContext ); return TRUE; } // PDD_ISR()
HRESULT STDMETHODCALLTYPE CRubyScript::InterruptScriptThread( /* [in] */ SCRIPTTHREADID stidThread, /* [in] */ const EXCEPINFO __RPC_FAR *pexcepinfo, /* [in] */ DWORD dwFlags) { ATLTRACE(_T("InterruptScriptThread\n")); if (stidThread == SCRIPTTHREADID_ALL || stidThread == SCRIPTTHREADID_BASE || stidThread == m_dwThreadID) { if (CInitializer::InRuby()) { HANDLE h = CRubyWrapper::GetCWrapper()->GetHandle(); SuspendThread(h); InterruptThread(h); ResumeThread(h); } } return S_OK; }
BOOL PDD_ISR(PDWORD pdwWaitTime) { InterruptThread( g_pddInterface.pvPddContext ); return TRUE; } // PDD_ISR()