1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 03:25:41 +00:00

(#42) Validate not-null handle

This commit is contained in:
Oliver Booth 2021-06-27 13:06:17 +01:00
parent 49ed44100d
commit 4828300076

View File

@ -1,4 +1,5 @@
using System.Threading;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace X10D
@ -15,7 +16,12 @@ namespace X10D
/// <returns>A task which encapsulates <see cref="WaitHandle.WaitOne()" />.</returns>
public static Task WaitOneAsync(this WaitHandle handle)
{
return new(() => handle.WaitOne());
if (handle is null)
{
throw new ArgumentNullException(nameof(handle));
}
return new Task(() => handle.WaitOne());
}
}
}