March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
using System.Threading;
namespace Samples
{
public class DuplicateWaitObjectExceptionSample
{
public static AutoResetEvent[] autoResetEvents =
new AutoResetEvent[2];
public static void Main()
{
try
{
autoResetEvents[0] = new AutoResetEvent(false);
autoResetEvents[1] = autoResetEvents[0];
WaitHandle.WaitAll(autoResetEvents);
}
catch(DuplicateWaitObjectException e)
{
Console.WriteLine("Exception: {0}", e);
}
}
}
}
Exception: System.DuplicateWaitObjectException: Duplicate objects in argument. at System.Threading.WaitHandle.WaitMultiple(WaitHandle[] waitHandles, Int32 millisecondsTimeout, Boolean exitContext, Boolean WaitAll) at System.Threading.WaitHandle.WaitAll(WaitHandle[] waitHandles, Int32 millisecondsTimeout, ...
Read now
Unlock full access