Mercurial > pub > ImplabNet
annotate Implab/SyncContextPromiseT.cs @ 240:fa6cbf4d8841 v3
refactoring, moving to dotnercore, simplifying promises
author | cin |
---|---|
date | Tue, 23 Jan 2018 19:39:21 +0300 |
parents | 3eb3255d8cc5 |
children |
rev | line source |
---|---|
211
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
1 using System.Threading; |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
2 using System; |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
3 |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
4 namespace Implab { |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
5 public class SyncContextPromise<T> : Promise<T> { |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
6 readonly SynchronizationContext m_context; |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
7 |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
8 public SyncContextPromise(SynchronizationContext context) { |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
9 Safe.ArgumentNotNull(context, "context"); |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
10 m_context = context; |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
11 } |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
12 |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
13 protected override void SignalHandler(HandlerDescriptor handler, int signal) { |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
14 m_context.Post(x => base.SignalHandler(handler, signal), null); |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
15 } |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
16 } |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
17 } |
3eb3255d8cc5
Code review, added a non generic version of SyncContextPromise
cin
parents:
diff
changeset
|
18 |