comparison Implab/Parallels/AsyncPool.cs @ 14:e943453e5039 promises

Implemented interllocked queue fixed promise syncronization
author cin
date Wed, 06 Nov 2013 17:49:12 +0400
parents 6ec82bf68c8e
children 5a4b735ba669
comparison
equal deleted inserted replaced
13:b0feb5b9ad1c 14:e943453e5039
22 } 22 }
23 }); 23 });
24 24
25 return p; 25 return p;
26 } 26 }
27
28 public static Promise<T> InvokeNewThread<T>(Func<T> func) {
29 var p = new Promise<T>();
30
31 var worker = new Thread(() => {
32 try {
33 p.Resolve(func());
34 } catch (Exception e) {
35 p.Reject(e);
36 }
37 });
38 worker.IsBackground = true;
39
40 worker.Start();
41
42 return p;
43 }
27 } 44 }
28 } 45 }