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