private void Connect_MsgQueue() { lock (_lockMsgQueue) { if (null == m_pMsgQueue || IntPtr.Zero == m_pMsgQueue) { m_pMsgQueue = CommApi.CTP_CreateMsgQueue(); CommApi.CTP_RegOnConnect(m_pMsgQueue, _fnOnConnect_Holder); CommApi.CTP_RegOnDisconnect(m_pMsgQueue, _fnOnDisconnect_Holder); CommApi.CTP_RegOnRspError(m_pMsgQueue, _fnOnRspError_Holder); //由底层启动线程 CommApi.CTP_StartMsgQueue(m_pMsgQueue); } } }