RecThread.IsBackground =true;
RecThread.Start( );
SendThread.IsBackground =true;
SendThread.Start( );//RecThread.Join( );
//SendThread.Join( );
RecThread.Start( );
SendThread.IsBackground =true;
SendThread.Start( );//RecThread.Join( );
//SendThread.Join( );
{
for(int i=0;i<10;i++)
{
lock(this)
{
if(SendFlag) //发送线程有需要发送的短消息,等待发送线程的脉冲
Monitor.Pulse(this);//改
TestRec(i);
Thread.Sleep(500);
SendFlag = false;
Monitor.Wait(this);//改
}
}
}//RecThread.Join( );
//SendThread.Join( );