//=========================================================================== int CSerialThread::m_IScanReadLoop(){ int iErr, iItem, iReportSync; int aiData[N_DATA_ITEMS]; iReportSync = 1; // report next sync while(TRUE){ iErr = m_WaitForSync( iReportSync ); if( iErr) goto LoopExit; // exit check for( iItem=0; iItem<N_DATA_ITEMS; iItem++) { iErr = m_ReadDataItem( &aiData[iItem]); if(!m_blnThreadActive) goto LoopExit; // exit check if( iErr) break; } if( iErr ) { iReportSync = 1; // report next sync } else { m_WriteData( aiData, N_DATA_ITEMS ); iReportSync = 0; // don't report next sync } } LoopExit: CP_printf("\n\n"); return 0; }
//=========================================================================== int CEyeTrack::ReadingFunc( ){ int iErr, iItem; int aiData[N_DATA_ITEMS]; iErr = m_WaitForSync(); if( iErr) goto LoopExit; // exit check for( iItem=0; iItem<N_DATA_ITEMS; iItem++) { iErr = m_ReadDataItem( &aiData[iItem]); if( !IsActive()) goto LoopExit; // exit check if( iErr) break; } if( iErr ) { m_iReportSync = 1; // report next sync } else { m_WriteData( aiData, N_DATA_ITEMS ); m_iReportSync = 0; // don't report next sync } LoopExit: return 0; }