PromiseHelper.cs
14 lines
| 403 B
| text/x-csharp
|
CSharpLexer
/ Implab.Test / PromiseHelper.cs
|
|
r11 | using Implab.Parallels; | ||
|
|
r10 | using System.Threading; | ||
| namespace Implab.Test { | ||||
|
|
r77 | static class PromiseHelper { | ||
|
|
r73 | public static IPromise<T> Sleep<T>(int timeout, T retVal) { | ||
|
|
r149 | return AsyncPool.Invoke((ct) => { | ||
| ct.CancellationRequested(ct.CancelOperation); | ||||
|
|
r10 | Thread.Sleep(timeout); | ||
| return retVal; | ||||
| }); | ||||
| } | ||||
| } | ||||
| } | ||||
