annotate Implab.Test/PromiseHelper.cs @ 35:2880242f987a diagnostics

initial log capabilities
author cin
date Mon, 14 Apr 2014 18:25:26 +0400
parents 6ec82bf68c8e
children 3b8393be3441
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
6ec82bf68c8e refactoring
cin
parents: 10
diff changeset
1 using Implab.Parallels;
6ec82bf68c8e refactoring
cin
parents: 10
diff changeset
2 using System;
10
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
3 using System.Collections.Generic;
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
4 using System.Linq;
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
5 using System.Text;
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
6 using System.Threading;
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
7
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
8 namespace Implab.Test {
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
9 class PromiseHelper {
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
10 public static Promise<T> Sleep<T>(int timeout, T retVal) {
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
11 return AsyncPool.Invoke(() => {
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
12 Thread.Sleep(timeout);
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
13 return retVal;
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
14 });
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
15 }
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
16 }
aa33d0bb8c0c implemeted new cancellable promises concept
cin
parents:
diff changeset
17 }