-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Port `Akka.Tests.Actor.Scheduler` tests to async/await * Port `Akka.Tests.Actor.Scheduler` tests to `async/await` - 2 * Make code neater
- Loading branch information
Showing
2 changed files
with
34 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Akka.Tests.Util | ||
{ | ||
public static class TaskHelpers | ||
{ | ||
public static async Task<bool> AwaitWithTimeout(this Task parentTask, TimeSpan timeout) | ||
{ | ||
var delayed = Task.Delay(timeout); | ||
await Task.WhenAny(delayed, parentTask); | ||
return parentTask.IsCompleted; | ||
} | ||
} | ||
} |