a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
25 lines
607 B
C#
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;
|
|
}
|
|
}
|
|
}
|