diff --git a/src/GZCTF/Utils/AsyncManualResetEvent.cs b/src/GZCTF/Utils/AsyncManualResetEvent.cs
index c2068c2da..217a17ce9 100644
--- a/src/GZCTF/Utils/AsyncManualResetEvent.cs
+++ b/src/GZCTF/Utils/AsyncManualResetEvent.cs
@@ -1,9 +1,17 @@
namespace GZCTF.Utils;
+///
+/// Asynchronous manual reset event
+/// This class is similar to but asynchronous and non-blocking
+///
public sealed class AsyncManualResetEvent
{
private volatile TaskCompletionSource _tcs = new();
+ ///
+ /// Wait for the event to be signaled
+ ///
+ /// Cancellation token
public async Task WaitAsync(CancellationToken cancellationToken = default)
{
var tcs = _tcs;
@@ -21,6 +29,12 @@ private async Task Delay(int milliseconds)
return false;
}
+ ///
+ /// Wait for the event to be signaled
+ ///
+ /// Timeout
+ /// Cancellation token
+ /// Returns false if timeout
public async Task WaitAsync(int milliseconds, CancellationToken cancellationToken = default)
{
var tcs = _tcs;
@@ -32,6 +46,9 @@ public async Task WaitAsync(int milliseconds, CancellationToken cancellati
return await await Task.WhenAny(tcs.Task, cancelTcs.Task, Delay(milliseconds));
}
+ ///
+ /// Set the event to signaled
+ ///
public void Set()
{
var tcs = _tcs;
@@ -40,6 +57,9 @@ public void Set()
tcs.Task.Wait();
}
+ ///
+ /// Reset the event to non-signaled
+ ///
public void Reset()
{
var newTcs = new TaskCompletionSource();