Reputation: 12127
I would like to find a way to combine these two lines:
cancellationToken.WaitHandle.WaitOne() |> ignore
waitHandle.WaitOne() |> ignore
whichever happens first would let the execution flow continue. Can this be done?
Upvotes: 3
Views: 206
Reputation: 17153
I assume you could put the the two handles in an array and then wait on it. Something like:
[|
cancellationToken.WaitHandle
waitHandle
|] |> WaitHandle.WaitAny |> ignore
Note: I have not tried to compile or run this code.
Upvotes: 2