ntwain/NTwain/Internals/WrappedManualResetEvent.cs
2014-11-29 22:16:19 -05:00

58 lines
855 B
C#

using System;
using System.Threading;
namespace NTwain.Internals
{
// just a test
class WrappedManualResetEvent : IDisposable
{
#if NET35
ManualResetEvent _mre;
#else
ManualResetEventSlim _slim;
#endif
public WrappedManualResetEvent()
{
#if NET35
_mre = new ManualResetEvent(false);
#else
_slim = new ManualResetEventSlim();
#endif
}
public void Wait()
{
#if NET35
_mre.WaitOne();
#else
_slim.Wait();
#endif
}
public void Set()
{
#if NET35
_mre.Set();
#else
_slim.Set();
#endif
}
#region IDisposable Members
public void Dispose()
{
#if NET35
_mre.Close();
#else
_slim.Dispose();
#endif
}
#endregion
}
}