Exemple #1
0
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;
}