15,471
社区成员
发帖
与我相关
我的任务
分享
DWORD thproc( LPVOID )
{
MSG msg;
while ( 1 )
{
if ( PeekMessage( msg, ... ) )
{
if ( msg.message == WM_QUIT )
break;
}
Sleep( 100 );
}
Trace( "线程退出\n" );
}
PostThreadMessage( m_hThreadID, WM_QUIT );
DWORD dwRet = WaitForSingleObject( m_hThread, 10000 );
if ( m_hThread != NULL )
{
PostThreadMessage( m_hThreadID, WM_QUIT );
DWORD dwRet = WaitForSingleObject( m_hThread, 10000 );
if ( 超时 )
{
强制结束线程
}
CloseHandle( m_hThread );
m_hThread = NULL;
m_hThreadID = 0;
}