示例#1
0
文件: Room.cs 项目: djdeathgirl/Jabbo
        public void sendRoomData(ConnectedUser User)
        {
            WaitDelegate X  = new WaitDelegate(sendRoomData2);
            IAsyncResult ar = X.BeginInvoke(User, null, null);

            ar.AsyncWaitHandle.WaitOne(1000, false);
            if (ar.IsCompleted)
            {
                X.EndInvoke(ar);
            }
        }
示例#2
0
        private void _2()
        {
            //Cyclic polling
            WaitDelegate wd = Wait;
            IAsyncResult ar = wd.BeginInvoke(2000, null, null);

            //Running
            while (!ar.IsCompleted)
            {
                Console.WriteLine("!ar.IsCompleted");
                Thread.Sleep(100);
            }

            //Get result
            int res = wd.EndInvoke(ar);

            Console.WriteLine(res);

            //If the main process is terminated, so subprocess is terminate too
        }
示例#3
0
文件: Room.cs 项目: jabbo/Jabbo
 public void sendRoomData(ConnectedUser User)
 {
     WaitDelegate X = new WaitDelegate(sendRoomData2);
     IAsyncResult ar = X.BeginInvoke(User, null, null);
     ar.AsyncWaitHandle.WaitOne(1000, false);
     if (ar.IsCompleted)
     {
         X.EndInvoke(ar);
     }
 }