Mercurial > hg > ucis.core
comparison Util/AsyncResultBase.cs @ 7:4b78cc5f116b
Fixes and improvements (some untested)
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Sun, 13 Jan 2013 18:44:17 +0100 |
parents | 2933f7750542 |
children | a6faa87767bb |
comparison
equal
deleted
inserted
replaced
6:5ce7a138fdba | 7:4b78cc5f116b |
---|---|
33 this.Error = error; | 33 this.Error = error; |
34 lock (this) { | 34 lock (this) { |
35 IsCompleted = true; | 35 IsCompleted = true; |
36 if (WaitEvent != null) WaitEvent.Set(); | 36 if (WaitEvent != null) WaitEvent.Set(); |
37 } | 37 } |
38 if (Callback != null) SysThreadPool.QueueUserWorkItem(CallCallback); | 38 if (Callback != null) { |
39 if (synchronously) { | |
40 Callback(this); | |
41 } else { | |
42 SysThreadPool.QueueUserWorkItem(CallCallback); | |
43 } | |
44 } | |
39 } | 45 } |
40 | 46 |
41 protected void ThrowError() { | 47 protected void ThrowError() { |
42 if (Error != null) throw Error; | 48 if (Error != null) throw Error; |
43 } | 49 } |