日期:2014-05-17  浏览次数:20969 次

POLL LOCK问题。

//如果有消息通知时,才查询数据库
            while (!backgroundWorkerForEvent.CancellationPending)
            {
                byte[] arrMsgRec = new byte[100];
                // 将接受到的数据存入到输入  arrMsgRec中;  
                int length = -1;
                try
                {
                    lock (DoNetWork.lockObj)
                    {
                        if (DoNetWork.sockClient.Poll(1000, SelectMode.SelectRead))
                        {
                            length = DoNetWork.sockClient.Receive(arrMsgRec); // 接
                           
                        }
                        else
                        {
                           ...
                        }
                    }
                }
}

这是后台线程接收消息通知的,