Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

25 lines
607 B
C#

// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System.Threading;
namespace System.Web.Mvc.Async.Test
{
public sealed class SignalContainer<T>
{
private volatile object _item;
private readonly AutoResetEvent _waitHandle = new AutoResetEvent(false /* initialState */);
public void Signal(T item)
{
_item = item;
_waitHandle.Set();
}
public T Wait()
{
_waitHandle.WaitOne();
return (T)_item;
}
}
}