我現(xiàn)在使用ch375做一個數(shù)據(jù)采集通訊同時輸出信號,在上位機(jī)開了一個線程調(diào)用庫函數(shù)提供的讀寫函數(shù)往復(fù)通訊,同時在主畫面中存在按鈕調(diào)用讀寫函數(shù)通訊出現(xiàn)死機(jī)的情況,請問庫函數(shù)提東的函數(shù)是否支持兩個線程同時調(diào)用,如支持在線程中應(yīng)如何設(shè)置

敬請回復(fù)

下附:線程中調(diào)用庫函數(shù)的部分源碼

struct CCommInfo { public: unsigned char m_Char1; unsigned char m_Char2; unsigned char m_Char3; unsigned char m_Char4; unsigned char m_Char5; unsigned char m_Char6; unsigned char m_Char7; unsigned char m_Char8; }; // 線程中使用的發(fā)送流程 unsigned long dlen=8; m_pReadSize=&dlen; m_pWriteSize=&dlen; m_WriteOnOffInfo.m_Char1=0X80; m_WriteOnOffInfo.m_Char2=0X80; m_WriteOnOffInfo.m_Char3=0X00; m_WriteOnOffInfo.m_Char4=0X00; m_WriteOnOffInfo.m_Char5=0X00; m_WriteOnOffInfo.m_Char6=0X00; m_WriteOnOffInfo.m_Char7=0X00; m_WriteOnOffInfo.m_Char8=0X00; CH375WriteData(m_Index,&m_WriteOnOffInfo,m_pWriteSize); Sleep(10); LONG iRet=CH375QueryBufUpload(m_Index); if(iRet>0) CH375ReadData(m_Index,&m_ReadInfo,m_pReadSize); //獲得限位開關(guān)前握手信息 if(m_ReadInfo.m_Char3==0X00)//獲得上下開關(guān)值 { if(m_ReadInfo.m_Char6==0) { m_UpOnOff=0; //上開關(guān) m_DnOnOff=0; //下開關(guān) int iLed = atoi(m_pView->GetDocument()->m_strLed); m_pView->m_DlgShowData->m_LedUp.SetLed(0); m_pView->m_DlgShowData->m_LedDn.SetLed(0); }else if(m_ReadInfo.m_Char6==1) { m_UpOnOff=1; //上開關(guān) m_DnOnOff=0; //下開關(guān) m_pView->m_DlgShowData->m_LedDn.SetLed(0); m_pView->m_DlgShowData->m_LedUp.SetLed(1); }else if(m_ReadInfo.m_Char6==2) { m_UpOnOff=0; //上開關(guān) m_DnOnOff=1; //下開關(guān) m_pView->m_DlgShowData->m_LedUp.SetLed(0); m_pView->m_DlgShowData->m_LedDn.SetLed(1); } Sleep(100); }