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:
parent
49ed44100d
commit
4828300076
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user