关于多线程中iasyncresult.asyncwaithandle.waitone()方法的问题?

C# code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace threading
{
    public delegate int TakesAWhileDelegate(int data,int ms);
    class Program
    {
        static int TakesAWhile(int data, int ms)
        {
            Console.WriteLine("TakesAWhile started");
            Thread.Sleep(ms);
            Console.WriteLine("TakesAWhile completed");
            return ++data;
        }
        static void Main(string[] args)
        {
           

            TakesAWhileDelegate d1 = TakesAWhile;
            IAsyncResult ar = d1.BeginInvoke(1, 3000, null, null);
            while (true)
            {
                Console.Write(".");
                if (ar.AsyncWaitHandle.WaitOne(50, false))
                {
                    Console.WriteLine("can get the result now");
                    break;
                }
            }
            int result = d1.EndInvoke(ar);
            Console.WriteLine("result:{0}", result);
            Console.ReadKey();
        }
    }
}



if (ar.AsyncWaitHandle.WaitOne(50, false))中的false改写为true后效果为什么依然相同?
这个方法不起作用,

作者: procedure123   发布时间: 2011-01-21

WaitHandle.WaitOne 方法阻止当前线程,直到当前的 WaitHandle 收到信号
net内部的自动管理默认超时时间(一个socket缓存时间)不超过70秒

作者: wuyq11   发布时间: 2011-01-21

引用 1 楼 wuyq11 的回复:
WaitHandle.WaitOne 方法阻止当前线程,直到当前的 WaitHandle 收到信号
net内部的自动管理默认超时时间(一个socket缓存时间)不超过70秒
+

作者: tourstar   发布时间: 2011-01-21