PromiseHelper.cs
22 lines
| 663 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; | ||||
}); | ||||
} | ||||
cin
|
r203 | |||
public static IPromise Sleep(int timeout) { | ||||
return AsyncPool.Invoke((ct) => { | ||||
ct.CancellationRequested(ct.CancelOperation); | ||||
Thread.Sleep(timeout); | ||||
return 0; | ||||
}); | ||||
} | ||||
cin
|
r10 | } | ||
} | ||||