本文整理汇总了C++中CPARAM_THREADPROC类的典型用法代码示例。如果您正苦于以下问题:C++ CPARAM_THREADPROC类的具体用法?C++ CPARAM_THREADPROC怎么用?C++ CPARAM_THREADPROC使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPARAM_THREADPROC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Input
/******************************************************************************
Function Name : TSDataReadThreadProc
Input(s) : LPVOID pVoid - Thread Parameter
Output : DWORD - S_OK if Success otherwise S_FALSE
Functionality : Starts The Read Thread
Member of : -
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 01/04/2011
Modifications :
******************************************************************************/
DWORD WINAPI TSDataReadThreadProc(LPVOID pVoid)
{
USES_CONVERSION;
CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC*) pVoid;
if (pThreadParam == NULL)
{
return ((DWORD)-1);
}
CTSExecutionCAN* pTSXExecutionCAN = (CTSExecutionCAN*)pThreadParam->m_pBuffer;
if (pTSXExecutionCAN == NULL)
{
return ((DWORD)-1);
}
bool bLoopON = true;
pThreadParam->m_unActionCode = INVOKE_FUNCTION;
while (bLoopON)
{
WaitForSingleObject(pThreadParam->m_hActionEvent, INFINITE);
switch (pThreadParam->m_unActionCode)
{
case INVOKE_FUNCTION:
{
ReadTSXDataBuffer(pTSXExecutionCAN); // Retrieve message from the driver
}
break;
case EXIT_THREAD:
{
bLoopON = false;
}
break;
case CREATE_TIME_MAP:
{
}
break;
case INACTION:
{
ReadVerifyTSXDataBuffer(pTSXExecutionCAN);
// nothing right at this moment
}
break;
default:
{
}
break;
}
}
SetEvent(pThreadParam->hGetExitNotifyEvent());
return 0;
}
示例2: FlexMsgReadThreadProc_Stub
DWORD WINAPI FlexMsgReadThreadProc_Stub(LPVOID pVoid)
{
VALIDATE_POINTER_RETURN_VAL(sg_pIlog, (DWORD)-1);
CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC *) pVoid;
pThreadParam->m_unActionCode = CREATE_TIME_MAP;
// Validate certain required pointers
bool bLoopON = true;
while (bLoopON)
{
static HANDLE ahClientReadHandle[MAX_CLIENT_ALLOWED] = {0};
for (UINT i = 0; i < sg_unClientCnt; i++)
{
ahClientReadHandle[i] = sg_asClientToBufMap[i].hClientHandle;
}
DWORD dwIndex = WaitForMultipleObjects(sg_unClientCnt, ahClientReadHandle, FALSE, INFINITE);
if (dwIndex == WAIT_FAILED)
{
GetSystemErrorString();
}
else
{
UINT Index = dwIndex - WAIT_OBJECT_0;
switch (pThreadParam->m_unActionCode)
{
case INVOKE_FUNCTION:
{
// Retrieve message from the pipe
ProcessCanMsg(sg_asClientToBufMap[Index].hPipeFileHandle, Index);
}
break;
case CREATE_TIME_MAP:
{
PerformAnOperation(GET_TIME_MAP);
ProcessCanMsg(sg_asClientToBufMap[Index].hPipeFileHandle, Index);
pThreadParam->m_unActionCode = INVOKE_FUNCTION;
}
break;
case EXIT_THREAD:
{
bLoopON = false;
}
break;
default:
case INACTION:
{
// nothing right at this moment
}
break;
}
}
}
SetEvent(pThreadParam->hGetExitNotifyEvent());
return 0;
}
示例3: BSDataReadThreadProc
/**
* \param[in] pVoid contains CBusStatisticCAN pointer
*
* Thread Function that is used to read the driver data and
* updates the Bus Statistics.
*/
DWORD WINAPI BSDataReadThreadProc(LPVOID pVoid)
{
CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC*) pVoid;
if (pThreadParam == NULL)
{
return ((DWORD)-1);
}
CBusStatisticCAN* pBusStatistics = static_cast<CBusStatisticCAN*> (pThreadParam->m_pBuffer);
if (pBusStatistics == NULL)
{
return ((DWORD)-1);
}
bool bLoopON = true;
pThreadParam->m_unActionCode = INVOKE_FUNCTION;
while (bLoopON)
{
WaitForSingleObject(pThreadParam->m_hActionEvent, INFINITE);
switch (pThreadParam->m_unActionCode)
{
case INVOKE_FUNCTION:
{
ReadBSDataBuffer(pBusStatistics); // Retrieve message from the driver
}
break;
case EXIT_THREAD:
{
bLoopON = false;
}
break;
case CREATE_TIME_MAP:
{
//Nothing at this moment
}
break;
case INACTION:
{
// nothing right at this moment
}
break;
default:
{
}
break;
}
}
SetEvent(pThreadParam->hGetExitNotifyEvent());
return 0;
}
示例4: DataCopyThreadProc
DWORD WINAPI DataCopyThreadProc(LPVOID pVoid)
{
CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC*) pVoid;
if (pThreadParam == NULL)
{
// TBD
}
CFrameProcessor_Common* pCurrObj = (CFrameProcessor_Common*) pThreadParam->m_pBuffer;
if (pCurrObj == NULL)
{
// TBD
}
//pThreadParam->m_unActionCode = INACTION;
bool bLoopON = true;
while (bLoopON)
{
WaitForSingleObject(pThreadParam->m_hActionEvent, INFINITE);
switch (pThreadParam->m_unActionCode)
{
case INVOKE_FUNCTION:
{
// Retrieve message from the driver
pCurrObj->vRetrieveDataFromBuffer();
ResetEvent(pThreadParam->m_hActionEvent);
}
break;
case EXIT_THREAD:
{
bLoopON = false;
}
break;
case CREATE_TIME_MAP:
{
pCurrObj->InitTimeParams();
pThreadParam->m_unActionCode = INVOKE_FUNCTION;
SetEvent(pThreadParam->m_hActionEvent);
}
break;
default:
case INACTION:
{
// nothing right at this moment
}
break;
}
}
SetEvent(pThreadParam->hGetExitNotifyEvent());
return 0;
}
示例5: ExecuteThread
DWORD WINAPI ExecuteThread( LPVOID pParam )
{
USES_CONVERSION;
CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC*) pParam;
if (pThreadParam == NULL)
{
return ((DWORD)-1);
}
CTSExecutorChildFrame* pExecutionFrame = (CTSExecutorChildFrame*)pThreadParam->m_pBuffer;
if (pExecutionFrame == NULL)
{
return ((DWORD)-1);
}
bool bLoopON = true;
pThreadParam->m_unActionCode = INVOKE_FUNCTION;
while (bLoopON)
{
WaitForSingleObject(pThreadParam->m_hActionEvent, INFINITE);
switch (pThreadParam->m_unActionCode)
{
case INVOKE_FUNCTION:
{
pExecutionFrame->m_ouTSExecutor.Execute();
pExecutionFrame->SendMessage(WM_EXECUSTIONOVER, 0, 0);
}
break;
case EXIT_THREAD:
{
bLoopON = false;
}
break;
default:
{
}
break;
}
}
SetEvent(pThreadParam->hGetExitNotifyEvent());
return S_OK;
}
示例6: SigWatchDataReadThreadProc_C
DWORD WINAPI SigWatchDataReadThreadProc_C(LPVOID pVoid)
{
CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC *) pVoid;
if (pThreadParam == NULL)
{
return (DWORD)-1;
}
CSignalWatch_CAN* pSWCan = (CSignalWatch_CAN*)pThreadParam->m_pBuffer;
if (pSWCan == NULL)
{
return (DWORD)-1;
}
bool bLoopON = true;
pThreadParam->m_unActionCode = INVOKE_FUNCTION;
while (bLoopON)
{
WaitForSingleObject(pThreadParam->m_hActionEvent, INFINITE);
switch (pThreadParam->m_unActionCode)
{
case INVOKE_FUNCTION:
{
ReadCANDataBuffer(pSWCan); // Retrieve message from the driver
}
break;
case EXIT_THREAD:
{
bLoopON = false;
}
break;
case CREATE_TIME_MAP:
{
//Nothing at this moment
}
break;
default:
case INACTION:
{
// nothing right at this moment
}
break;
}
}
SetEvent(pThreadParam->hGetExitNotifyEvent());
return 0;
}
示例7: BrokerThreadBusEmulation
DWORD WINAPI BrokerThreadBusEmulation(LPVOID pVoid)
{
CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC*) pVoid;
// Validate certain required pointers
//VALIDATE_POINTER_RETURN_VALUE_LOG(pThreadParam, -1);
//VALIDATE_POINTER_RETURN_VALUE_LOG(pThreadParam->m_hActionEvent, -1);
// Get hold of the bus simulation and error logger interfaces
HRESULT hResult = CoInitialize(NULL);
ISimENG* pISimENG = NULL;
hResult = CoCreateInstance(CLSID_SimENG, NULL, CLSCTX_LOCAL_SERVER,
IID_ISimENG, (LPVOID*) &pISimENG);
if ((S_OK != hResult) || (NULL == pISimENG))
{
return 0L;
}
bool bLoopON = true;
while (bLoopON)
{
WaitForSingleObject(pThreadParam->m_hActionEvent, INFINITE);
switch (pThreadParam->m_unActionCode)
{
case CONNECT:
{
sg_hResult = Worker_Connect(pISimENG, sg_pIlog);
SetEvent(sg_hNotifyFinish);
}
break;
case DISCONNECT:
{
sg_hResult = Worker_Disconnect(pISimENG, sg_pIlog);
SetEvent(sg_hNotifyFinish);
}
break;
case STOP_HARDWARE:
{
sg_hResult = Worker_StopHardware(pISimENG, sg_pIlog);
SetEvent(sg_hNotifyFinish);
}
break;
case START_HARDWARE:
{
sg_hResult = Worker_StartHardware(pISimENG, sg_pIlog);
SetEvent(sg_hNotifyFinish);
}
break;
case SEND_MESSAGE:
{
sg_hResult = Worker_SendCanMsg(pISimENG, sg_pIlog, sg_pouCanTxMsg);
SetEvent(sg_hNotifyFinish);
}
break;
case GET_TIME_MAP:
{
sg_hResult = Worker_GetTimeModeMapping(pISimENG, sg_pIlog);
SetEvent(sg_hNotifyFinish);
}
break;
case REGISTER:
{
sg_hResult = Worker_RegisterClient(pISimENG, sg_pIlog);
SetEvent(sg_hNotifyFinish);
}
break;
case UNREGISTER:
{
sg_hResult = Worker_UnregisterClient(pISimENG, sg_pIlog);
SetEvent(sg_hNotifyFinish);
}
break;
case EXIT_THREAD:
{
bLoopON = false;
}
break;
default:
case INACTION:
{
// nothing right at this moment
}
break;
}
}
// Release the bus simulation & error logger out-of-proc server components
//pISimENG->Release();
// Reset the interface pointers
pISimENG = NULL;
SetEvent(pThreadParam->hGetExitNotifyEvent());
return 0;
}
示例8: CanMsgReadThreadProc_CAN_ISolar_Eve
/**
* \brief Read thread procedure
* \param[in] pVoid contains the CPARAM_THREADPROC class object
* \return void
* \authors Prince Varghese
* \date 09.04.2013 Created
*/
DWORD WINAPI CanMsgReadThreadProc_CAN_ISolar_Eve(LPVOID pVoid)
{
USES_CONVERSION;
CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC*) pVoid;
/* Assign thread action to CREATE_TIME_MAP */
pThreadParam->m_unActionCode = CREATE_TIME_MAP;
bool bLoopON = true;
while (bLoopON)
{
Sleep (10); // To avoid continuous loop as there is no event mechanism
switch (pThreadParam->m_unActionCode)
{
case INVOKE_FUNCTION:
{
int functionType = 0;
unsigned int dataSize = 0;
if (ReceiveCommandFromClient(&functionType, &dataSize) >= 0)
{
switch (functionType)
{
case SEND_MESSAGE:
{
STCAN_MSG RxMsg;
int receiveResult = ReceiveCANMessageFromClient(&RxMsg);
if (receiveResult > 0)
{
sg_EVE_CANMsg.m_uDataInfo.m_sCANMsg.m_bCANFD = false;
sg_EVE_CANMsg.m_ucDataType = receiveResult;
sg_EVE_CANMsg.m_uDataInfo.m_sCANMsg = RxMsg;
RxMsg.m_ucChannel = 1;
vWriteIntoClientsBuffer(sg_EVE_CANMsg);
}
}
break;
default:
break;
}
}
}
break;
case EXIT_THREAD:
{
bLoopON = false;
}
break;
case CREATE_TIME_MAP:
{
SetEvent(pThreadParam->m_hActionEvent);
pThreadParam->m_unActionCode = INVOKE_FUNCTION;
}
break;
default:
case INACTION:
{
// nothing right at this moment
}
break;
}
}
SetEvent(pThreadParam->hGetExitNotifyEvent());
pThreadParam->m_hActionEvent = NULL;
return 0;
}
示例9: ReadDILCANMsg
DWORD WINAPI ReadDILCANMsg(LPVOID pVoid)
{
CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC*) pVoid;
if (pThreadParam != NULL)
{
CReadCanMsg* pCurrObj = (CReadCanMsg*) pThreadParam->m_pBuffer;
if (pCurrObj != NULL)
{
pThreadParam->m_unActionCode = INVOKE_FUNCTION; // Set default action
// Create the action event. In this case this will be used solely for
// thread exit procedure. The first entry will be used.
pThreadParam->m_hActionEvent = pCurrObj->m_ahActionEvent[0];
DWORD dwWaitRet;
BYTE byHIndex;
bool bLoopON = true;
while (bLoopON)
{
dwWaitRet = WaitForMultipleObjects(pCurrObj->m_nEvents,
pCurrObj->m_ahActionEvent, FALSE, INFINITE);
///// TEMP : BEGIN
DWORD dwLLimit = WAIT_OBJECT_0;
DWORD dwULimit = WAIT_OBJECT_0 + pCurrObj->m_nEvents - 1;
DWORD dwLLError = WAIT_ABANDONED_0;
DWORD dwULError = WAIT_ABANDONED_0 + pCurrObj->m_nEvents - 1;
if ((dwWaitRet >= dwLLimit) && (dwWaitRet <= dwULimit))
{
switch (pThreadParam->m_unActionCode)
{
case INVOKE_FUNCTION:
{
//Get the handle's index and pass it
byHIndex = (BYTE)(dwWaitRet - WAIT_OBJECT_0);
HANDLE hHandleSet = pCurrObj->m_ahActionEvent[byHIndex];
BYTE byNodeIndex;
if( pCurrObj->m_omHandleToNodeMgrMap.Lookup(hHandleSet, byNodeIndex))
{
//vRetrieveDataFromBuffer to read from that buffer
pCurrObj->vRetrieveDataFromBuffer(byNodeIndex);
}
//BOOL Result = ResetEvent(hHandleSet);
ResetEvent(hHandleSet);
}
break;
case EXIT_THREAD:
{
bLoopON = false;
}
break;
case INACTION:
{
// Signal the owner
SetEvent(pThreadParam->m_hThread2Owner);
Sleep(0);
// Wait until owner signals back.
WaitForSingleObject(pThreadParam->m_hOwner2Thread, INFINITE);
// Signal the owner
SetEvent(pThreadParam->m_hThread2Owner);
Sleep(0);
}
break;
case CREATE_TIME_MAP:
default:
break;
}
}
else if ((dwWaitRet >= dwLLError) && (dwWaitRet <= dwULError))
{
TRACE(_T(_("Abandoned... %X %d\n")), dwWaitRet, g_unCount++);
}
else if ( dwWaitRet == WAIT_TIMEOUT)
{
TRACE(_T("ReadDILCANMsg->WAIT_TIMEOUT %d\n"), g_unCount++);
}
else if (dwWaitRet == WAIT_FAILED)
{
TRACE(_T("WAIT_FAILED... %X %d\n"), GetLastError(), g_unCount++);
}
///// TEMP : END
}
SetEvent(pThreadParam->hGetExitNotifyEvent());
}
}
return 0;
}
示例10: LinMsgReadThreadProc_LIN_ISolar_Eve
/**
* \brief Read thread procedure
* \param[in] pVoid contains the CPARAM_THREADPROC class object
* \return void
* \authors Prince Varghese
* \date 09.04.2013 Created
*/
DWORD WINAPI LinMsgReadThreadProc_LIN_ISolar_Eve(LPVOID pVoid)
{
USES_CONVERSION;
CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC*) pVoid;
/* Assign thread action to CREATE_TIME_MAP */
pThreadParam->m_unActionCode = CREATE_TIME_MAP;
/* Dummy action event */
pThreadParam->m_hActionEvent = CreateEvent(nullptr, false, false, nullptr);
bool bLoopON = true;
while (bLoopON)
{
Sleep (10);
switch (pThreadParam->m_unActionCode)
{
case INVOKE_FUNCTION:
{
static STLIN_FRAME RxFrame;
static STLIN_MSG RxMsg;
static int iRxLength;
int iChecksum = 0;
RxMsg.m_ucDataLen = 0;
unsigned int uiDataType = ReceiveLINMessageFromClient(&RxFrame, &iRxLength);
if (iRxLength == LIN_PID_LENGTH)
{
RxMsg.m_ucMsgID = RxFrame.m_ucMsgID;
RxMsg.m_ucChksum = 0;
vValidateReceivedLinPID(RxMsg);
/*sg_EVE_LINMsg.m_ucDataType = TX_FLAG;*/
sg_EVE_LINMsg.m_uDataInfo.m_sLINMsg = RxMsg;
RxMsg.m_ucChannel = LIN_CHANNEL_1;
//vWriteIntoClientsBuffer(sg_EVE_LINMsg);
}
else if (iRxLength > LIN_PID_LENGTH)
{
RxMsg.m_ucMsgID = RxFrame.m_ucMsgID;
RxMsg.m_ucChksum = RxFrame.m_ucChksum;
RxMsg.m_ucDataLen = iRxLength - (LIN_PID_LENGTH + LIN_CHECKSUM_LENGTH); // 2 (1 byte checksum and 1byte pid)
for(int i=0; i<8; i++)
{
RxMsg.m_ucData[i] = RxFrame.m_ucData[i];
iChecksum = iChecksum + RxFrame.m_ucData[i];
if (iChecksum > 255)
{
iChecksum = iChecksum - 255;
}
}
RxMsg.m_ucChksum = 255 - iChecksum;
if((RxMsg.m_ucChksum != RxFrame.m_ucChksum))
{
RxMsg.m_ucMsgTyp = LIN_CHECKSUM_ERROR;
RxMsg.m_ucChksum = RxFrame.m_ucChksum;
}
else
{
vValidateReceivedLinMsg(RxMsg);
}
if(uiDataType == TX_LOOPBACK_UDP_DATA)
{
sg_EVE_LINMsg.m_ucDataType = TX_FLAG;
}
else if((uiDataType == RX_UDP_PID)||(uiDataType == RX_UDP_DATA))
{
sg_EVE_LINMsg.m_ucDataType = RX_FLAG;
}
RxMsg.m_ucChannel = LIN_CHANNEL_1;
sg_EVE_LINMsg.m_uDataInfo.m_sLINMsg = RxMsg;
RxMsg.m_ucChannel = 1;
vWriteIntoClientsBuffer(sg_EVE_LINMsg);
}
}
break;
case EXIT_THREAD:
{
bLoopON = false;
}
break;
case CREATE_TIME_MAP:
{
SetEvent(pThreadParam->m_hActionEvent);
//.........这里部分代码省略.........
示例11: LINMsgReadThreadProc_LIN_Vector_XL
/**
* \brief Read thread procedure
* \param[in] pVoid contains the CPARAM_THREADPROC class object
* \return void
* \authors Arunkumar Karri
* \date 07.19.2013 Created
*/
DWORD WINAPI CDIL_LIN_VectorXL::LINMsgReadThreadProc_LIN_Vector_XL(LPVOID pVoid)
{
USES_CONVERSION;
CPARAM_THREADPROC* pThreadParam = (CPARAM_THREADPROC*) pVoid;
XLstatus xlStatus = XL_SUCCESS;
/* Assign thread action to CREATE_TIME_MAP */
pThreadParam->m_unActionCode = CREATE_TIME_MAP;
/* Set the event to LIN_Vector_XL driver for wakeup and frame arrival notification */
//for (UINT i = 0; i < sg_unClientCnt; i++)
{
xlStatus = xlSetNotification (g_xlPortHandle[0], &g_hDataEvent[0], 1);
}
/* Set the thread action event to first notification event handle */
if (g_hDataEvent[0] != nullptr)
{
pThreadParam->m_hActionEvent = g_hDataEvent[0];
}
/* Get the handle to the controller and validate it */
VALIDATE_POINTER_RETURN_VALUE_LOG(pThreadParam->m_hActionEvent, (DWORD)-1);
DWORD dwResult = 0;
unsigned int msgsrx;
XLevent xlEvent;
bool bLoopON = true;
while (bLoopON)
{
WaitForSingleObject(g_hDataEvent[0], INFINITE);
switch (pThreadParam->m_unActionCode)
{
case INVOKE_FUNCTION:
{
bool bMoreDataExist;
msgsrx = RECEIVE_EVENT_SIZE;
xlStatus = xlReceive(g_xlPortHandle[0], &msgsrx, &xlEvent);
while (xlStatus == XL_SUCCESS )
{
switch (xlStatus)
{
case XL_SUCCESS:
{
if ( g_pouDIL_LIN_Vector_XL != nullptr )
{
g_pouDIL_LIN_Vector_XL->ProcessLINMsg(xlEvent);
bMoreDataExist = true;
}
}
break;
default:
break;
}
xlStatus = xlReceive(g_xlPortHandle[0], &msgsrx, &xlEvent);;
}
}
break;
case EXIT_THREAD:
{
bLoopON = false;
}
break;
case CREATE_TIME_MAP:
{
//vCreateTimeModeMapping(pThreadParam->m_hActionEvent);
SetEvent(pThreadParam->m_hActionEvent);
pThreadParam->m_unActionCode = INVOKE_FUNCTION;
}
break;
default:
case INACTION:
{
// nothing right at this moment
}
break;
}
}
SetEvent(pThreadParam->hGetExitNotifyEvent());
{
ResetEvent(g_hDataEvent[0]);
g_hDataEvent[0] = nullptr;
}
pThreadParam->m_hActionEvent = nullptr;
return 0;
}
示例12: Worker_Disconnect
HRESULT Worker_Disconnect(ISimENG* /*pISimENGLoc*/, Base_WrapperErrorLogger* pIlogLoc)
{
if (GetCurrState() == STATE_PRIMORDIAL)
{
sg_acErrStr = _("CAN_STUB_DeselectHwInterface called at STATE_PRIMORDIAL");
return S_FALSE;
}
else if (GetCurrState() == STATE_RESET)
{
pIlogLoc->vLogAMessage(__FILE__, __LINE__,
(_("CAN_STUB_DeselectHwInterface called at improper state")));
return S_FALSE;
}
// Close the message reading thread
if(sg_unClientCnt <= 0 )
{
//Some Error Happened But Thread close is required.
//sg_unClientCnt = 0 means there is no data flow and thread
//force termination is safe.
sg_sParmRThreadStub.bForceTerminateThread();
}
else
{
sg_sParmRThreadStub.bTerminateThread();
}
return S_OK;
}
示例13: CAN_PerformInitOperations
HRESULT CDIL_CAN_STUB::CAN_PerformInitOperations(void)
{
HRESULT hResult = S_FALSE;
// Initialize the critical section
InitializeCriticalSection(&sg_CSBroker);
// Create the notification event
sg_hNotifyFinish = CreateEvent(NULL, false, false, NULL);
if (NULL != sg_hNotifyFinish)
{
// Then create the broker worker thread
sg_sBrokerObjBusEmulation.m_hActionEvent = CreateEvent(NULL, false,
false, NULL);
ResetEvent(sg_sBrokerObjBusEmulation.m_hActionEvent);
sg_sBrokerObjBusEmulation.m_unActionCode = INACTION;
if (sg_sBrokerObjBusEmulation.bStartThread(BrokerThreadBusEmulation))
{
hResult = S_OK;
}
else
{
CloseHandle(sg_hNotifyFinish);
sg_hNotifyFinish = NULL;
}
}
return hResult;
}
示例14: CAN_PerformClosureOperations
HRESULT CDIL_CAN_STUB::CAN_PerformClosureOperations(void)
{
//First remove all the client
for (UINT nCount = 0; nCount < sg_unClientCnt; nCount++)
{
CAN_RegisterClient(FALSE, sg_asClientToBufMap[nCount].dwClientID, "");
}
// First disconnect from the simulation engine
CAN_DeselectHwInterface();
// Then terminate the broker thread
sg_sBrokerObjBusEmulation.bTerminateThread();
// Close the notification event
if (NULL != sg_hNotifyFinish)
{
CloseHandle(sg_hNotifyFinish);
sg_hNotifyFinish = NULL;
}
// Delete the critical section
DeleteCriticalSection(&sg_CSBroker);
sg_pIlog = NULL; // Log interface pointer
SetCurrState(STATE_PRIMORDIAL);
return S_OK;
}
示例15: bStopGraphReadThread
/* Function to stop msg read thread*/
BOOL bStopGraphReadThread()
{
BOOL bReturn = FALSE;
bReturn = m_ouGraphReadThread.bTerminateThread();
m_ouGraphReadThread.m_hActionEvent = NULL;
m_ouGraphReadThread.m_unActionCode = IDLE;
return bReturn;
}