Mercurial > pub > ImplabNet
annotate Implab.Test/PromiseHelper.cs @ 229:5f7a3e1d32b9 v2
JsonXmlReader performance tuning
JsonScanner now operates strings and doesn't
parses number and literals.
Added SerializationHelpers to common serialize/deserialize operations
author | cin |
---|---|
date | Tue, 12 Sep 2017 19:07:42 +0300 |
parents | 4d9830a9bbb8 |
children | d82909310094 |
rev | line source |
---|---|
11 | 1 using Implab.Parallels; |
10 | 2 using System.Threading; |
3 | |
4 namespace Implab.Test { | |
77 | 5 static class PromiseHelper { |
73 | 6 public static IPromise<T> Sleep<T>(int timeout, T retVal) { |
149 | 7 return AsyncPool.Invoke((ct) => { |
8 ct.CancellationRequested(ct.CancelOperation); | |
10 | 9 Thread.Sleep(timeout); |
10 return retVal; | |
11 }); | |
12 } | |
203
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
149
diff
changeset
|
13 |
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
149
diff
changeset
|
14 public static IPromise Sleep(int timeout) { |
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
149
diff
changeset
|
15 return AsyncPool.Invoke((ct) => { |
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
149
diff
changeset
|
16 ct.CancellationRequested(ct.CancelOperation); |
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
149
diff
changeset
|
17 Thread.Sleep(timeout); |
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
149
diff
changeset
|
18 return 0; |
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
149
diff
changeset
|
19 }); |
4d9830a9bbb8
Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents:
149
diff
changeset
|
20 } |
10 | 21 } |
22 } |