Rank: Newbie
Groups: Registered
Joined: 3/9/2012(UTC) Posts: 5 Location: London
Was thanked: 3 time(s) in 3 post(s)
|
Here's a repo, in case it helps. This test will fail in NCrunch, but works elsewhere (eg. Resharper, other continuous testing tools): Code:
[Test]
public void TryWaitAll()
{
Func<TimeSpan, ManualResetEvent> runThread = t =>
{
var mre = new ManualResetEvent(false);
var thread = new Thread(() =>
{
Thread.Sleep(t);
mre.Set();
});
thread.Start();
return mre;
};
WaitHandle.WaitAll(
new WaitHandle[]
{
runThread(TimeSpan.FromSeconds(1)),
runThread(TimeSpan.FromSeconds(2)),
});
}
|
1 user thanked whirly for this useful post.
|
|