void CUserManage::CheckUser(DWORD Time) { USER_MAP::Iterator Iter1; USER_MAP::Iterator Iter2; try { EnterCriticalSection( &g_CheckCritical ); //Lock } catch(...) { return; } try { Iter1 = m_UserMap.m_UserTypeMap.begin(); Iter2 = m_UserMap.m_UserTypeMap.end(); CUser* pUser; for( ;Iter1!=Iter2;Iter1++ ) { pUser = (*Iter1).second; if( pUser && pUser->Check(Time) ) { m_UserMap.DeleteData( Iter1->first ); Iter1 = m_UserMap.m_UserTypeMap.begin(); Iter2 = m_UserMap.m_UserTypeMap.end(); } } } catch(...) { OutInfo( "Error:CheckUser" ); } LeaveCriticalSection( &g_CheckCritical ); //UnLock }
void TUI::Redraw() { PrepareRedraw(); try{ EDevice.Statistic->RenderDUMP_RT.Begin(); if (EDevice.Begin()){ EDevice.UpdateView (); EDevice.ResetMaterial (); Tools->RenderEnvironment (); //. temporary reset filter ( ) for (u32 k=0; k<HW.Caps.raster.dwStages; k++){ if( psDeviceFlags.is(rsFilterLinear)){ EDevice.SetSS(k,D3DSAMP_MAGFILTER,D3DTEXF_LINEAR); EDevice.SetSS(k,D3DSAMP_MINFILTER,D3DTEXF_LINEAR); EDevice.SetSS(k,D3DSAMP_MIPFILTER,D3DTEXF_LINEAR); } else { EDevice.SetSS(k,D3DSAMP_MAGFILTER,D3DTEXF_POINT); EDevice.SetSS(k,D3DSAMP_MINFILTER,D3DTEXF_POINT); EDevice.SetSS(k,D3DSAMP_MIPFILTER,D3DTEXF_POINT); } } // draw grid if (psDeviceFlags.is(rsDrawGrid)){ DU_impl.DrawGrid (); DU_impl.DrawPivot (m_Pivot); } try{ Tools->Render (); }catch(...){ ELog.DlgMsg(mtError, "Please notify AlexMX!!! Critical error has occured in render routine!!! [Type B]"); } // draw selection rect if(m_SelectionRect) DU_impl.DrawSelectionRect(m_SelStart,m_SelEnd); // draw axis DU_impl.DrawAxis(EDevice.m_Camera.GetTransform()); try{ // end draw EDevice.End(); }catch(...){ ELog.DlgMsg(mtError, "Please notify AlexMX!!! Critical error has occured in render routine!!! [Type C]"); } } EDevice.Statistic->RenderDUMP_RT.End(); }catch(...){ ELog.DlgMsg(mtError, "Please notify AlexMX!!! Critical error has occured in render routine!!! [Type A]"); // _clear87(); // FPU::m24r(); // ELog.DlgMsg(mtError, "Critical error has occured in render routine.\nEditor may work incorrectly."); EDevice.End(); // EDevice.Resize(m_D3DWindow->Width,m_D3DWindow->Height); } OutInfo(); }
//外部接收数据线程 DWORD WINAPI ReceiveWorkerThread(LPVOID lp) { CUdpIocp* pUdpIocp = (CUdpIocp*)lp; BOOL bRet = 0; //返回值 DWORD nbytes = 0; //返回大小 DWORD WorkIndex = 0; //ID LPOVERLAPPED pOvl = NULL; //返回结构 CUdpSocket* pSocket = NULL; //socket while (1) { //监听完成端口,有数据才会往下运行 bRet = GetQueuedCompletionStatus(pUdpIocp->m_hServerIOCPort,&nbytes, &WorkIndex,&pOvl,INFINITE); //有信息判断是否正确 if(bRet || pOvl) { if(bRet) //如果信息返回正确 { //检查是否超过最大处理数 if( WorkIndex > (DWORD)pUdpIocp->m_ServerSocketSize ) goto loop_pass; //继续 //得到要处理的Socket pSocket = (CUdpSocket*)pUdpIocp->m_pSocketArray[WorkIndex]; //检查pSocket是否为空 if( !pSocket ) goto loop_pass; //继续 //判断是哪个消息 switch( pOvl->Offset ) { case OVL_RECEIVE: //接收 //pUdpIocp->Recv(); //检查是否出错 if( !nbytes ) { //pSocket->Close(); //关闭 pSocket->Recv(); //继续接收 //pUdpIocp->PushSocket( pSocket ); goto loop_pass; //继续 } //恢复错误计数器 pSocket->m_nPending = 0; pSocket->m_nWouldblock = 0; pSocket->ReceivedData( (int)nbytes ); //处理接收的数据 pSocket->Recv(); //继续接收 //pUdpIocp->PushSocket( pSocket ); break; case OVL_SEND: //发送 //恢复错误计数器 pSocket->m_nPending = 0; pSocket->m_nWouldblock = 0; break; case OVL_CLOSE: //关闭 //pSocket->Close(); //关闭 break; default: break; } } else { if( pOvl ) //关闭 { //检查是否超过最大处理数 if( WorkIndex > (DWORD)pUdpIocp->m_ServerSocketSize ) goto loop_pass; //继续 //得到要处理的Socket pSocket = (CUdpSocket*)pUdpIocp->m_pSocketArray[WorkIndex]; //检查pSocket是否为空 if( !pSocket ) goto loop_pass; //继续 //判断是哪个消息 switch( pOvl->Offset ) { case OVL_RECEIVE: //接收 //pUdpIocp->Recv(); //检查是否出错 if( !nbytes ) { pSocket->Recv(); //继续接收 //pUdpIocp->PushSocket( pSocket ); goto loop_pass; //继续 } //恢复错误计数器 pSocket->m_nPending = 0; pSocket->m_nWouldblock = 0; //pSocket->ReceivedData( (int)nbytes ); //处理接收的数据 pSocket->Recv(); //继续接收 //pUdpIocp->PushSocket( pSocket ); break; case OVL_SEND: //发送 //恢复错误计数器 pSocket->m_nPending = 0; pSocket->m_nWouldblock = 0; break; case OVL_CLOSE: //关闭 //pSocket->Close(); //关闭 break; default: break; } } } } else { OutInfo( "ERROR:GetQueuedCompletionStatus()" ); } loop_pass: continue; //继续循环 } return 1; //返回1 }