Skip to content

Commit f11bf59

Browse files
committed
Removed allocation of the wait handle
1 parent 78ba6bf commit f11bf59

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/DotNext.Threading/Threading/IAsyncEvent.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
namespace DotNext.Threading;
22

3+
using static Tasks.Synchronization;
4+
35
/// <summary>
46
/// Represents asynchronous event.
57
/// </summary>
@@ -55,8 +57,5 @@ public interface IAsyncEvent : IDisposable, IResettable
5557
/// <exception cref="ObjectDisposedException">The current instance has already been disposed.</exception>
5658
/// <exception cref="ArgumentOutOfRangeException"><paramref name="timeout"/> is negative.</exception>
5759
bool Wait(TimeSpan timeout)
58-
{
59-
using var task = WaitAsync(timeout).AsTask();
60-
return task.Wait(timeout);
61-
}
60+
=> WaitAsync(timeout).Wait();
6261
}

0 commit comments

Comments
 (0)