##// END OF EJS Templates
Code review, added a non generic version of SyncContextPromise
cin -
r211:3eb3255d8cc5 v2
parent child
Show More
@@ -0,0 +1,18
1 using System.Threading;
2 using System;
3
4 namespace Implab {
5 public class SyncContextPromise<T> : Promise<T> {
6 readonly SynchronizationContext m_context;
7
8 public SyncContextPromise(SynchronizationContext context) {
9 Safe.ArgumentNotNull(context, "context");
10 m_context = context;
11 }
12
13 protected override void SignalHandler(HandlerDescriptor handler, int signal) {
14 m_context.Post(x => base.SignalHandler(handler, signal), null);
15 }
16 }
17 }
18
@@ -1,188 +1,204
1 using Implab.Components;
1 using Implab.Components;
2 using Implab.Diagnostics;
2 using Implab.Diagnostics;
3 using Implab.Parallels;
3 using Implab.Parallels;
4 using System;
4 using System;
5 using System.Collections.Generic;
5 using System.Collections.Generic;
6 using System.Linq;
6 using System.Linq;
7 using System.Text;
7 using System.Text;
8 using System.Threading;
8 using System.Threading;
9 using System.Threading.Tasks;
9 using System.Threading.Tasks;
10 using System.Windows.Forms;
10 using System.Windows.Forms;
11
11
12 namespace Implab.Fx {
12 namespace Implab.Fx {
13 public class StaApartment : RunnableComponent {
13 public class StaApartment : RunnableComponent {
14 readonly Thread m_worker;
14 readonly Thread m_worker;
15 SynchronizationContext m_syncContext;
15 SynchronizationContext m_syncContext;
16 SyncContextPromise m_enterPromise;
17
16 readonly Promise m_threadStarted;
18 readonly Promise m_threadStarted;
17 readonly Promise m_threadTerminated;
19 readonly Promise m_threadTerminated;
18
20
19 public StaApartment() : base(true) {
21 public StaApartment() : base(true) {
20 m_threadStarted = new Promise();
22 m_threadStarted = new Promise();
21 m_threadTerminated = new Promise();
23 m_threadTerminated = new Promise();
22
24
23 m_worker = new Thread(WorkerEntry);
25 m_worker = new Thread(WorkerEntry);
24 m_worker.SetApartmentState(ApartmentState.STA);
26 m_worker.SetApartmentState(ApartmentState.STA);
25 m_worker.IsBackground = true;
27 m_worker.IsBackground = true;
26 m_worker.Name = "STA managed aparment";
28 m_worker.Name = "STA managed aparment";
27 }
29 }
28
30
29 public SynchronizationContext SyncContext {
31 public SynchronizationContext SyncContext {
30 get {
32 get {
31 if (m_syncContext == null)
33 if (m_syncContext == null)
32 throw new InvalidOperationException();
34 throw new InvalidOperationException();
33 return m_syncContext;
35 return m_syncContext;
34 }
36 }
35 }
37 }
36
38
39 /// <summary>
40 /// Returns the promise which will dispatch all handlers inside the apartment using it's <see cref="SynchronizationContext"/>
41 /// </summary>
42 /// <remarks>
43 /// Current implementation is optimized and will lost aync operation stack
44 /// </remarks>
45 /// <returns>The promise</returns>
46 public IPromise Enter() {
47 if (m_enterPromise == null)
48 throw new InvalidOperationException();
49 return m_enterPromise;
50 }
51
37 public IPromise Invoke(Action<ICancellationToken> action) {
52 public IPromise Invoke(Action<ICancellationToken> action) {
38 Safe.ArgumentNotNull(action, "action");
53 Safe.ArgumentNotNull(action, "action");
39
54
40 if (m_syncContext == null)
55 if (m_syncContext == null)
41 throw new InvalidOperationException();
56 throw new InvalidOperationException();
42 var p = new Promise();
57 var p = new Promise();
43 var lop = TraceContext.Instance.CurrentOperation;
58 var lop = TraceContext.Instance.CurrentOperation;
44
59
45 m_syncContext.Post(x => {
60 m_syncContext.Post(x => {
46 TraceContext.Instance.EnterLogicalOperation(lop, false);
61 TraceContext.Instance.EnterLogicalOperation(lop, false);
47 try {
62 try {
48 if (p.CancelOperationIfRequested())
63 if (p.CancelOperationIfRequested())
49 return;
64 return;
50
65
51 action(p);
66 action(p);
52 p.Resolve();
67 p.Resolve();
53 } catch (Exception e) {
68 } catch (Exception e) {
54 p.Reject(e);
69 p.Reject(e);
55 } finally {
70 } finally {
56 TraceContext.Instance.Leave();
71 TraceContext.Instance.Leave();
57 }
72 }
58 }, null);
73 }, null);
59
74
60 return p;
75 return p;
61 }
76 }
62
77
63 public IPromise<T> Invoke<T>(Func<ICancellationToken, T> action) {
78 public IPromise<T> Invoke<T>(Func<ICancellationToken, T> action) {
64 Safe.ArgumentNotNull(action, "action");
79 Safe.ArgumentNotNull(action, "action");
65
80
66 if (m_syncContext == null)
81 if (m_syncContext == null)
67 throw new InvalidOperationException();
82 throw new InvalidOperationException();
68 var p = new Promise<T>();
83 var p = new Promise<T>();
69 var lop = TraceContext.Instance.CurrentOperation;
84 var lop = TraceContext.Instance.CurrentOperation;
70
85
71 m_syncContext.Post(x => {
86 m_syncContext.Post(x => {
72 TraceContext.Instance.EnterLogicalOperation(lop, false);
87 TraceContext.Instance.EnterLogicalOperation(lop, false);
73 try {
88 try {
74 if (p.CancelOperationIfRequested())
89 if (p.CancelOperationIfRequested())
75 return;
90 return;
76 p.Resolve(action(p));
91 p.Resolve(action(p));
77 } catch (Exception e) {
92 } catch (Exception e) {
78 p.Reject(e);
93 p.Reject(e);
79 } finally {
94 } finally {
80 TraceContext.Instance.Leave();
95 TraceContext.Instance.Leave();
81 }
96 }
82 }, null);
97 }, null);
83
98
84 return p;
99 return p;
85 }
100 }
86
101
87 public IPromise Invoke(Action action) {
102 public IPromise Invoke(Action action) {
88 Safe.ArgumentNotNull(action, "action");
103 Safe.ArgumentNotNull(action, "action");
89
104
90 if (m_syncContext == null)
105 if (m_syncContext == null)
91 throw new InvalidOperationException();
106 throw new InvalidOperationException();
92 var p = new Promise();
107 var p = new Promise();
93 var lop = TraceContext.Instance.CurrentOperation;
108 var lop = TraceContext.Instance.CurrentOperation;
94
109
95 m_syncContext.Post(x => {
110 m_syncContext.Post(x => {
96 TraceContext.Instance.EnterLogicalOperation(lop, false);
111 TraceContext.Instance.EnterLogicalOperation(lop, false);
97 try {
112 try {
98 if (p.CancelOperationIfRequested())
113 if (p.CancelOperationIfRequested())
99 return;
114 return;
100 action();
115 action();
101 p.Resolve();
116 p.Resolve();
102 } catch (Exception e) {
117 } catch (Exception e) {
103 p.Reject(e);
118 p.Reject(e);
104 } finally {
119 } finally {
105 TraceContext.Instance.Leave();
120 TraceContext.Instance.Leave();
106 }
121 }
107 }, null);
122 }, null);
108
123
109 return p;
124 return p;
110 }
125 }
111
126
112 public IPromise<T> Invoke<T>(Func<T> action) {
127 public IPromise<T> Invoke<T>(Func<T> action) {
113 Safe.ArgumentNotNull(action, "action");
128 Safe.ArgumentNotNull(action, "action");
114
129
115 if (m_syncContext == null)
130 if (m_syncContext == null)
116 throw new InvalidOperationException();
131 throw new InvalidOperationException();
117 var p = new Promise<T>();
132 var p = new Promise<T>();
118 var lop = TraceContext.Instance.CurrentOperation;
133 var lop = TraceContext.Instance.CurrentOperation;
119
134
120 m_syncContext.Post(x => {
135 m_syncContext.Post(x => {
121 TraceContext.Instance.EnterLogicalOperation(lop, false);
136 TraceContext.Instance.EnterLogicalOperation(lop, false);
122 try {
137 try {
123 if (p.CancelOperationIfRequested())
138 if (p.CancelOperationIfRequested())
124 return;
139 return;
125 p.Resolve(action());
140 p.Resolve(action());
126 } catch (Exception e) {
141 } catch (Exception e) {
127 p.Reject(e);
142 p.Reject(e);
128 } finally {
143 } finally {
129 TraceContext.Instance.Leave();
144 TraceContext.Instance.Leave();
130 }
145 }
131 }, null);
146 }, null);
132
147
133 return p;
148 return p;
134 }
149 }
135
150
136
151
137 /// <summary>
152 /// <summary>
138 /// Starts the apartment thread
153 /// Starts the apartment thread
139 /// </summary>
154 /// </summary>
140 /// <returns>Promise which will be fullfiled when the syncronization
155 /// <returns>Promise which will be fullfiled when the syncronization
141 /// context will be ready to accept tasks.</returns>
156 /// context will be ready to accept tasks.</returns>
142 protected override IPromise OnStart() {
157 protected override IPromise OnStart() {
143 m_worker.Start();
158 m_worker.Start();
144 return m_threadStarted;
159 return m_threadStarted;
145 }
160 }
146
161
147 /// <summary>
162 /// <summary>
148 /// Posts quit message to the message loop of the apartment
163 /// Posts quit message to the message loop of the apartment
149 /// </summary>
164 /// </summary>
150 /// <returns>Promise</returns>
165 /// <returns>Promise</returns>
151 protected override IPromise OnStop() {
166 protected override IPromise OnStop() {
152 m_syncContext.Post(x => Application.ExitThread(), null);
167 m_syncContext.Post(x => Application.ExitThread(), null);
153 return m_threadTerminated;
168 return m_threadTerminated;
154 }
169 }
155
170
156 void WorkerEntry() {
171 void WorkerEntry() {
157 m_syncContext = new WindowsFormsSynchronizationContext();
172 m_syncContext = new WindowsFormsSynchronizationContext();
158 SynchronizationContext.SetSynchronizationContext(m_syncContext);
173 SynchronizationContext.SetSynchronizationContext(m_syncContext);
159
174 m_enterPromise = new SyncContextPromise(m_syncContext);
160 m_threadStarted.Resolve();
175 m_threadStarted.Resolve();
176 m_enterPromise.Resolve();
161
177
162 Application.OleRequired();
178 Application.OleRequired();
163 Application.Run();
179 Application.Run();
164
180
165 try {
181 try {
166 OnShutdown();
182 OnShutdown();
167 m_threadTerminated.Resolve();
183 m_threadTerminated.Resolve();
168 } catch(Exception err) {
184 } catch(Exception err) {
169 m_threadTerminated.Reject(err);
185 m_threadTerminated.Reject(err);
170 }
186 }
171 }
187 }
172
188
173 /// <summary>
189 /// <summary>
174 /// Called from the STA apartment after the message loop is terminated, override this
190 /// Called from the STA apartment after the message loop is terminated, override this
175 /// method to handle apartment cleanup.
191 /// method to handle apartment cleanup.
176 /// </summary>
192 /// </summary>
177 protected virtual void OnShutdown() {
193 protected virtual void OnShutdown() {
178 }
194 }
179
195
180 protected override void Dispose(bool disposing) {
196 protected override void Dispose(bool disposing) {
181 if (disposing) {
197 if (disposing) {
182 if (!m_threadTerminated.IsResolved)
198 if (!m_threadTerminated.IsResolved)
183 m_syncContext.Post(x => Application.ExitThread(), null);
199 m_syncContext.Post(x => Application.ExitThread(), null);
184 }
200 }
185 base.Dispose(disposing);
201 base.Dispose(disposing);
186 }
202 }
187 }
203 }
188 }
204 }
@@ -1,274 +1,275
1 ο»Ώ<?xml version="1.0" encoding="utf-8"?>
1 ο»Ώ<?xml version="1.0" encoding="utf-8"?>
2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6 <ProjectGuid>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</ProjectGuid>
6 <ProjectGuid>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</ProjectGuid>
7 <OutputType>Library</OutputType>
7 <OutputType>Library</OutputType>
8 <RootNamespace>Implab</RootNamespace>
8 <RootNamespace>Implab</RootNamespace>
9 <AssemblyName>Implab</AssemblyName>
9 <AssemblyName>Implab</AssemblyName>
10 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
10 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11 <ReleaseVersion>0.2</ReleaseVersion>
11 <ReleaseVersion>0.2</ReleaseVersion>
12 <ProductVersion>8.0.30703</ProductVersion>
12 <ProductVersion>8.0.30703</ProductVersion>
13 <SchemaVersion>2.0</SchemaVersion>
13 <SchemaVersion>2.0</SchemaVersion>
14 </PropertyGroup>
14 </PropertyGroup>
15 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16 <DebugSymbols>true</DebugSymbols>
16 <DebugSymbols>true</DebugSymbols>
17 <DebugType>full</DebugType>
17 <DebugType>full</DebugType>
18 <Optimize>false</Optimize>
18 <Optimize>false</Optimize>
19 <OutputPath>bin\Debug</OutputPath>
19 <OutputPath>bin\Debug</OutputPath>
20 <DefineConstants>TRACE;DEBUG;</DefineConstants>
20 <DefineConstants>TRACE;DEBUG;</DefineConstants>
21 <ErrorReport>prompt</ErrorReport>
21 <ErrorReport>prompt</ErrorReport>
22 <WarningLevel>4</WarningLevel>
22 <WarningLevel>4</WarningLevel>
23 <ConsolePause>false</ConsolePause>
23 <ConsolePause>false</ConsolePause>
24 <RunCodeAnalysis>true</RunCodeAnalysis>
24 <RunCodeAnalysis>true</RunCodeAnalysis>
25 </PropertyGroup>
25 </PropertyGroup>
26 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27 <DebugType>full</DebugType>
27 <DebugType>full</DebugType>
28 <Optimize>true</Optimize>
28 <Optimize>true</Optimize>
29 <OutputPath>bin\Release</OutputPath>
29 <OutputPath>bin\Release</OutputPath>
30 <ErrorReport>prompt</ErrorReport>
30 <ErrorReport>prompt</ErrorReport>
31 <WarningLevel>4</WarningLevel>
31 <WarningLevel>4</WarningLevel>
32 <ConsolePause>false</ConsolePause>
32 <ConsolePause>false</ConsolePause>
33 </PropertyGroup>
33 </PropertyGroup>
34 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' ">
34 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' ">
35 <DebugSymbols>true</DebugSymbols>
35 <DebugSymbols>true</DebugSymbols>
36 <DebugType>full</DebugType>
36 <DebugType>full</DebugType>
37 <Optimize>false</Optimize>
37 <Optimize>false</Optimize>
38 <OutputPath>bin\Debug</OutputPath>
38 <OutputPath>bin\Debug</OutputPath>
39 <DefineConstants>TRACE;DEBUG;NET_4_5</DefineConstants>
39 <DefineConstants>TRACE;DEBUG;NET_4_5</DefineConstants>
40 <ErrorReport>prompt</ErrorReport>
40 <ErrorReport>prompt</ErrorReport>
41 <WarningLevel>4</WarningLevel>
41 <WarningLevel>4</WarningLevel>
42 <RunCodeAnalysis>true</RunCodeAnalysis>
42 <RunCodeAnalysis>true</RunCodeAnalysis>
43 <ConsolePause>false</ConsolePause>
43 <ConsolePause>false</ConsolePause>
44 </PropertyGroup>
44 </PropertyGroup>
45 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
45 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
46 <Optimize>true</Optimize>
46 <Optimize>true</Optimize>
47 <OutputPath>bin\Release</OutputPath>
47 <OutputPath>bin\Release</OutputPath>
48 <ErrorReport>prompt</ErrorReport>
48 <ErrorReport>prompt</ErrorReport>
49 <WarningLevel>4</WarningLevel>
49 <WarningLevel>4</WarningLevel>
50 <ConsolePause>false</ConsolePause>
50 <ConsolePause>false</ConsolePause>
51 <DefineConstants>NET_4_5</DefineConstants>
51 <DefineConstants>NET_4_5</DefineConstants>
52 </PropertyGroup>
52 </PropertyGroup>
53 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMono|AnyCPU' ">
53 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMono|AnyCPU' ">
54 <DebugSymbols>true</DebugSymbols>
54 <DebugSymbols>true</DebugSymbols>
55 <DebugType>full</DebugType>
55 <DebugType>full</DebugType>
56 <Optimize>false</Optimize>
56 <Optimize>false</Optimize>
57 <OutputPath>bin\Debug</OutputPath>
57 <OutputPath>bin\Debug</OutputPath>
58 <DefineConstants>TRACE;DEBUG;NET_4_5;MONO</DefineConstants>
58 <DefineConstants>TRACE;DEBUG;NET_4_5;MONO</DefineConstants>
59 <ErrorReport>prompt</ErrorReport>
59 <ErrorReport>prompt</ErrorReport>
60 <WarningLevel>4</WarningLevel>
60 <WarningLevel>4</WarningLevel>
61 <RunCodeAnalysis>true</RunCodeAnalysis>
61 <RunCodeAnalysis>true</RunCodeAnalysis>
62 <ConsolePause>false</ConsolePause>
62 <ConsolePause>false</ConsolePause>
63 </PropertyGroup>
63 </PropertyGroup>
64 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMono|AnyCPU' ">
64 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMono|AnyCPU' ">
65 <Optimize>true</Optimize>
65 <Optimize>true</Optimize>
66 <OutputPath>bin\Release</OutputPath>
66 <OutputPath>bin\Release</OutputPath>
67 <DefineConstants>NET_4_5;MONO;</DefineConstants>
67 <DefineConstants>NET_4_5;MONO;</DefineConstants>
68 <ErrorReport>prompt</ErrorReport>
68 <ErrorReport>prompt</ErrorReport>
69 <WarningLevel>4</WarningLevel>
69 <WarningLevel>4</WarningLevel>
70 <ConsolePause>false</ConsolePause>
70 <ConsolePause>false</ConsolePause>
71 </PropertyGroup>
71 </PropertyGroup>
72 <ItemGroup>
72 <ItemGroup>
73 <Reference Include="System" />
73 <Reference Include="System" />
74 <Reference Include="System.Xml" />
74 <Reference Include="System.Xml" />
75 <Reference Include="mscorlib" />
75 <Reference Include="mscorlib" />
76 </ItemGroup>
76 </ItemGroup>
77 <ItemGroup>
77 <ItemGroup>
78 <Compile Include="Components\StateChangeEventArgs.cs" />
78 <Compile Include="Components\StateChangeEventArgs.cs" />
79 <Compile Include="CustomEqualityComparer.cs" />
79 <Compile Include="CustomEqualityComparer.cs" />
80 <Compile Include="Diagnostics\ConsoleTraceListener.cs" />
80 <Compile Include="Diagnostics\ConsoleTraceListener.cs" />
81 <Compile Include="Diagnostics\LogChannel.cs" />
81 <Compile Include="Diagnostics\LogChannel.cs" />
82 <Compile Include="Diagnostics\LogicalOperation.cs" />
82 <Compile Include="Diagnostics\LogicalOperation.cs" />
83 <Compile Include="Diagnostics\TextFileListener.cs" />
83 <Compile Include="Diagnostics\TextFileListener.cs" />
84 <Compile Include="Diagnostics\TraceLog.cs" />
84 <Compile Include="Diagnostics\TraceLog.cs" />
85 <Compile Include="Diagnostics\TraceEvent.cs" />
85 <Compile Include="Diagnostics\TraceEvent.cs" />
86 <Compile Include="Diagnostics\TraceEventType.cs" />
86 <Compile Include="Diagnostics\TraceEventType.cs" />
87 <Compile Include="ICancellable.cs" />
87 <Compile Include="ICancellable.cs" />
88 <Compile Include="IProgressHandler.cs" />
88 <Compile Include="IProgressHandler.cs" />
89 <Compile Include="IProgressNotifier.cs" />
89 <Compile Include="IProgressNotifier.cs" />
90 <Compile Include="IPromiseT.cs" />
90 <Compile Include="IPromiseT.cs" />
91 <Compile Include="IPromise.cs" />
91 <Compile Include="IPromise.cs" />
92 <Compile Include="IServiceLocator.cs" />
92 <Compile Include="IServiceLocator.cs" />
93 <Compile Include="ITaskController.cs" />
93 <Compile Include="ITaskController.cs" />
94 <Compile Include="Parallels\DispatchPool.cs" />
94 <Compile Include="Parallels\DispatchPool.cs" />
95 <Compile Include="Parallels\ArrayTraits.cs" />
95 <Compile Include="Parallels\ArrayTraits.cs" />
96 <Compile Include="Parallels\MTQueue.cs" />
96 <Compile Include="Parallels\MTQueue.cs" />
97 <Compile Include="Parallels\WorkerPool.cs" />
97 <Compile Include="Parallels\WorkerPool.cs" />
98 <Compile Include="ProgressInitEventArgs.cs" />
98 <Compile Include="ProgressInitEventArgs.cs" />
99 <Compile Include="Properties\AssemblyInfo.cs" />
99 <Compile Include="Properties\AssemblyInfo.cs" />
100 <Compile Include="Parallels\AsyncPool.cs" />
100 <Compile Include="Parallels\AsyncPool.cs" />
101 <Compile Include="Safe.cs" />
101 <Compile Include="Safe.cs" />
102 <Compile Include="SyncContextPromise.cs" />
102 <Compile Include="ValueEventArgs.cs" />
103 <Compile Include="ValueEventArgs.cs" />
103 <Compile Include="PromiseExtensions.cs" />
104 <Compile Include="PromiseExtensions.cs" />
104 <Compile Include="SyncContextPromise.cs" />
105 <Compile Include="SyncContextPromiseT.cs" />
105 <Compile Include="Diagnostics\OperationContext.cs" />
106 <Compile Include="Diagnostics\OperationContext.cs" />
106 <Compile Include="Diagnostics\TraceContext.cs" />
107 <Compile Include="Diagnostics\TraceContext.cs" />
107 <Compile Include="Diagnostics\LogEventArgs.cs" />
108 <Compile Include="Diagnostics\LogEventArgs.cs" />
108 <Compile Include="Diagnostics\LogEventArgsT.cs" />
109 <Compile Include="Diagnostics\LogEventArgsT.cs" />
109 <Compile Include="Diagnostics\Extensions.cs" />
110 <Compile Include="Diagnostics\Extensions.cs" />
110 <Compile Include="PromiseEventType.cs" />
111 <Compile Include="PromiseEventType.cs" />
111 <Compile Include="Parallels\AsyncQueue.cs" />
112 <Compile Include="Parallels\AsyncQueue.cs" />
112 <Compile Include="PromiseT.cs" />
113 <Compile Include="PromiseT.cs" />
113 <Compile Include="IDeferred.cs" />
114 <Compile Include="IDeferred.cs" />
114 <Compile Include="IDeferredT.cs" />
115 <Compile Include="IDeferredT.cs" />
115 <Compile Include="Promise.cs" />
116 <Compile Include="Promise.cs" />
116 <Compile Include="PromiseTransientException.cs" />
117 <Compile Include="PromiseTransientException.cs" />
117 <Compile Include="Parallels\Signal.cs" />
118 <Compile Include="Parallels\Signal.cs" />
118 <Compile Include="Parallels\SharedLock.cs" />
119 <Compile Include="Parallels\SharedLock.cs" />
119 <Compile Include="Diagnostics\ILogWriter.cs" />
120 <Compile Include="Diagnostics\ILogWriter.cs" />
120 <Compile Include="Diagnostics\ListenerBase.cs" />
121 <Compile Include="Diagnostics\ListenerBase.cs" />
121 <Compile Include="Parallels\BlockingQueue.cs" />
122 <Compile Include="Parallels\BlockingQueue.cs" />
122 <Compile Include="AbstractEvent.cs" />
123 <Compile Include="AbstractEvent.cs" />
123 <Compile Include="AbstractPromise.cs" />
124 <Compile Include="AbstractPromise.cs" />
124 <Compile Include="AbstractPromiseT.cs" />
125 <Compile Include="AbstractPromiseT.cs" />
125 <Compile Include="FuncTask.cs" />
126 <Compile Include="FuncTask.cs" />
126 <Compile Include="FuncTaskBase.cs" />
127 <Compile Include="FuncTaskBase.cs" />
127 <Compile Include="FuncTaskT.cs" />
128 <Compile Include="FuncTaskT.cs" />
128 <Compile Include="ActionChainTaskBase.cs" />
129 <Compile Include="ActionChainTaskBase.cs" />
129 <Compile Include="ActionChainTask.cs" />
130 <Compile Include="ActionChainTask.cs" />
130 <Compile Include="ActionChainTaskT.cs" />
131 <Compile Include="ActionChainTaskT.cs" />
131 <Compile Include="FuncChainTaskBase.cs" />
132 <Compile Include="FuncChainTaskBase.cs" />
132 <Compile Include="FuncChainTask.cs" />
133 <Compile Include="FuncChainTask.cs" />
133 <Compile Include="FuncChainTaskT.cs" />
134 <Compile Include="FuncChainTaskT.cs" />
134 <Compile Include="ActionTaskBase.cs" />
135 <Compile Include="ActionTaskBase.cs" />
135 <Compile Include="ActionTask.cs" />
136 <Compile Include="ActionTask.cs" />
136 <Compile Include="ActionTaskT.cs" />
137 <Compile Include="ActionTaskT.cs" />
137 <Compile Include="ICancellationToken.cs" />
138 <Compile Include="ICancellationToken.cs" />
138 <Compile Include="SuccessPromise.cs" />
139 <Compile Include="SuccessPromise.cs" />
139 <Compile Include="SuccessPromiseT.cs" />
140 <Compile Include="SuccessPromiseT.cs" />
140 <Compile Include="PromiseAwaiterT.cs" />
141 <Compile Include="PromiseAwaiterT.cs" />
141 <Compile Include="PromiseAwaiter.cs" />
142 <Compile Include="PromiseAwaiter.cs" />
142 <Compile Include="Components\ComponentContainer.cs" />
143 <Compile Include="Components\ComponentContainer.cs" />
143 <Compile Include="Components\Disposable.cs" />
144 <Compile Include="Components\Disposable.cs" />
144 <Compile Include="Components\DisposablePool.cs" />
145 <Compile Include="Components\DisposablePool.cs" />
145 <Compile Include="Components\ObjectPool.cs" />
146 <Compile Include="Components\ObjectPool.cs" />
146 <Compile Include="Components\ServiceLocator.cs" />
147 <Compile Include="Components\ServiceLocator.cs" />
147 <Compile Include="Components\IInitializable.cs" />
148 <Compile Include="Components\IInitializable.cs" />
148 <Compile Include="TaskController.cs" />
149 <Compile Include="TaskController.cs" />
149 <Compile Include="Components\App.cs" />
150 <Compile Include="Components\App.cs" />
150 <Compile Include="Components\IRunnable.cs" />
151 <Compile Include="Components\IRunnable.cs" />
151 <Compile Include="Components\ExecutionState.cs" />
152 <Compile Include="Components\ExecutionState.cs" />
152 <Compile Include="Components\RunnableComponent.cs" />
153 <Compile Include="Components\RunnableComponent.cs" />
153 <Compile Include="Components\IFactory.cs" />
154 <Compile Include="Components\IFactory.cs" />
154 <Compile Include="Automaton\IAlphabet.cs" />
155 <Compile Include="Automaton\IAlphabet.cs" />
155 <Compile Include="Automaton\ParserException.cs" />
156 <Compile Include="Automaton\ParserException.cs" />
156 <Compile Include="Automaton\IndexedAlphabetBase.cs" />
157 <Compile Include="Automaton\IndexedAlphabetBase.cs" />
157 <Compile Include="Automaton\IAlphabetBuilder.cs" />
158 <Compile Include="Automaton\IAlphabetBuilder.cs" />
158 <Compile Include="Automaton\RegularExpressions\AltToken.cs" />
159 <Compile Include="Automaton\RegularExpressions\AltToken.cs" />
159 <Compile Include="Automaton\RegularExpressions\BinaryToken.cs" />
160 <Compile Include="Automaton\RegularExpressions\BinaryToken.cs" />
160 <Compile Include="Automaton\RegularExpressions\CatToken.cs" />
161 <Compile Include="Automaton\RegularExpressions\CatToken.cs" />
161 <Compile Include="Automaton\RegularExpressions\StarToken.cs" />
162 <Compile Include="Automaton\RegularExpressions\StarToken.cs" />
162 <Compile Include="Automaton\RegularExpressions\SymbolToken.cs" />
163 <Compile Include="Automaton\RegularExpressions\SymbolToken.cs" />
163 <Compile Include="Automaton\RegularExpressions\EmptyToken.cs" />
164 <Compile Include="Automaton\RegularExpressions\EmptyToken.cs" />
164 <Compile Include="Automaton\RegularExpressions\Token.cs" />
165 <Compile Include="Automaton\RegularExpressions\Token.cs" />
165 <Compile Include="Automaton\RegularExpressions\IVisitor.cs" />
166 <Compile Include="Automaton\RegularExpressions\IVisitor.cs" />
166 <Compile Include="Automaton\AutomatonTransition.cs" />
167 <Compile Include="Automaton\AutomatonTransition.cs" />
167 <Compile Include="Formats\JSON\JSONElementContext.cs" />
168 <Compile Include="Formats\JSON\JSONElementContext.cs" />
168 <Compile Include="Formats\JSON\JSONElementType.cs" />
169 <Compile Include="Formats\JSON\JSONElementType.cs" />
169 <Compile Include="Formats\JSON\JSONGrammar.cs" />
170 <Compile Include="Formats\JSON\JSONGrammar.cs" />
170 <Compile Include="Formats\JSON\JSONParser.cs" />
171 <Compile Include="Formats\JSON\JSONParser.cs" />
171 <Compile Include="Formats\JSON\JSONScanner.cs" />
172 <Compile Include="Formats\JSON\JSONScanner.cs" />
172 <Compile Include="Formats\JSON\JsonTokenType.cs" />
173 <Compile Include="Formats\JSON\JsonTokenType.cs" />
173 <Compile Include="Formats\JSON\JSONWriter.cs" />
174 <Compile Include="Formats\JSON\JSONWriter.cs" />
174 <Compile Include="Formats\JSON\JSONXmlReader.cs" />
175 <Compile Include="Formats\JSON\JSONXmlReader.cs" />
175 <Compile Include="Formats\JSON\JSONXmlReaderOptions.cs" />
176 <Compile Include="Formats\JSON\JSONXmlReaderOptions.cs" />
176 <Compile Include="Formats\JSON\StringTranslator.cs" />
177 <Compile Include="Formats\JSON\StringTranslator.cs" />
177 <Compile Include="Automaton\MapAlphabet.cs" />
178 <Compile Include="Automaton\MapAlphabet.cs" />
178 <Compile Include="Formats\CharAlphabet.cs" />
179 <Compile Include="Formats\CharAlphabet.cs" />
179 <Compile Include="Formats\ByteAlphabet.cs" />
180 <Compile Include="Formats\ByteAlphabet.cs" />
180 <Compile Include="Automaton\IDFATable.cs" />
181 <Compile Include="Automaton\IDFATable.cs" />
181 <Compile Include="Automaton\IDFATableBuilder.cs" />
182 <Compile Include="Automaton\IDFATableBuilder.cs" />
182 <Compile Include="Automaton\DFATable.cs" />
183 <Compile Include="Automaton\DFATable.cs" />
183 <Compile Include="Automaton\RegularExpressions\RegularExpressionVisitor.cs" />
184 <Compile Include="Automaton\RegularExpressions\RegularExpressionVisitor.cs" />
184 <Compile Include="Automaton\RegularExpressions\ITaggedDFABuilder.cs" />
185 <Compile Include="Automaton\RegularExpressions\ITaggedDFABuilder.cs" />
185 <Compile Include="Formats\TextScanner.cs" />
186 <Compile Include="Formats\TextScanner.cs" />
186 <Compile Include="Formats\StringScanner.cs" />
187 <Compile Include="Formats\StringScanner.cs" />
187 <Compile Include="Formats\ReaderScanner.cs" />
188 <Compile Include="Formats\ReaderScanner.cs" />
188 <Compile Include="Formats\ScannerContext.cs" />
189 <Compile Include="Formats\ScannerContext.cs" />
189 <Compile Include="Formats\Grammar.cs" />
190 <Compile Include="Formats\Grammar.cs" />
190 <Compile Include="Automaton\RegularExpressions\EndTokenT.cs" />
191 <Compile Include="Automaton\RegularExpressions\EndTokenT.cs" />
191 <Compile Include="Automaton\RegularExpressions\EndToken.cs" />
192 <Compile Include="Automaton\RegularExpressions\EndToken.cs" />
192 <Compile Include="Automaton\RegularExpressions\RegularExpressionVisitorT.cs" />
193 <Compile Include="Automaton\RegularExpressions\RegularExpressionVisitorT.cs" />
193 <Compile Include="Automaton\AutomatonConst.cs" />
194 <Compile Include="Automaton\AutomatonConst.cs" />
194 <Compile Include="Automaton\RegularExpressions\RegularDFA.cs" />
195 <Compile Include="Automaton\RegularExpressions\RegularDFA.cs" />
195 <Compile Include="Components\LazyAndWeak.cs" />
196 <Compile Include="Components\LazyAndWeak.cs" />
196 <Compile Include="AbstractTask.cs" />
197 <Compile Include="AbstractTask.cs" />
197 <Compile Include="AbstractTaskT.cs" />
198 <Compile Include="AbstractTaskT.cs" />
198 <Compile Include="FailedPromise.cs" />
199 <Compile Include="FailedPromise.cs" />
199 <Compile Include="FailedPromiseT.cs" />
200 <Compile Include="FailedPromiseT.cs" />
200 <Compile Include="Components\PollingComponent.cs" />
201 <Compile Include="Components\PollingComponent.cs" />
201 </ItemGroup>
202 </ItemGroup>
202 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
203 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
203 <ItemGroup />
204 <ItemGroup />
204 <ProjectExtensions>
205 <ProjectExtensions>
205 <MonoDevelop>
206 <MonoDevelop>
206 <Properties>
207 <Properties>
207 <Policies>
208 <Policies>
208 <CSharpFormattingPolicy IndentSwitchBody="True" NamespaceBraceStyle="EndOfLine" ClassBraceStyle="EndOfLine" InterfaceBraceStyle="EndOfLine" StructBraceStyle="EndOfLine" EnumBraceStyle="EndOfLine" MethodBraceStyle="EndOfLine" ConstructorBraceStyle="EndOfLine" DestructorBraceStyle="EndOfLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" NewLineBeforeConstructorInitializerColon="NewLine" NewLineAfterConstructorInitializerColon="SameLine" BeforeIndexerDeclarationBracket="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
209 <CSharpFormattingPolicy IndentSwitchBody="True" NamespaceBraceStyle="EndOfLine" ClassBraceStyle="EndOfLine" InterfaceBraceStyle="EndOfLine" StructBraceStyle="EndOfLine" EnumBraceStyle="EndOfLine" MethodBraceStyle="EndOfLine" ConstructorBraceStyle="EndOfLine" DestructorBraceStyle="EndOfLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" NewLineBeforeConstructorInitializerColon="NewLine" NewLineAfterConstructorInitializerColon="SameLine" BeforeIndexerDeclarationBracket="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
209 <TextStylePolicy FileWidth="120" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
210 <TextStylePolicy FileWidth="120" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
210 <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" />
211 <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" />
211 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" />
212 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" />
212 <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
213 <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
213 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
214 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
214 <NameConventionPolicy>
215 <NameConventionPolicy>
215 <Rules>
216 <Rules>
216 <NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
217 <NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
217 <NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
218 <NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
218 <NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
219 <NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
219 <RequiredPrefixes>
220 <RequiredPrefixes>
220 <String>I</String>
221 <String>I</String>
221 </RequiredPrefixes>
222 </RequiredPrefixes>
222 </NamingRule>
223 </NamingRule>
223 <NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
224 <NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
224 <RequiredSuffixes>
225 <RequiredSuffixes>
225 <String>Attribute</String>
226 <String>Attribute</String>
226 </RequiredSuffixes>
227 </RequiredSuffixes>
227 </NamingRule>
228 </NamingRule>
228 <NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
229 <NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
229 <RequiredSuffixes>
230 <RequiredSuffixes>
230 <String>EventArgs</String>
231 <String>EventArgs</String>
231 </RequiredSuffixes>
232 </RequiredSuffixes>
232 </NamingRule>
233 </NamingRule>
233 <NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
234 <NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
234 <RequiredSuffixes>
235 <RequiredSuffixes>
235 <String>Exception</String>
236 <String>Exception</String>
236 </RequiredSuffixes>
237 </RequiredSuffixes>
237 </NamingRule>
238 </NamingRule>
238 <NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
239 <NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
239 <NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
240 <NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
240 <NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
241 <NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
241 <NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" />
242 <NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" />
242 <NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
243 <NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
243 <RequiredPrefixes>
244 <RequiredPrefixes>
244 <String>m_</String>
245 <String>m_</String>
245 </RequiredPrefixes>
246 </RequiredPrefixes>
246 </NamingRule>
247 </NamingRule>
247 <NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True">
248 <NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True">
248 <RequiredPrefixes>
249 <RequiredPrefixes>
249 <String>_</String>
250 <String>_</String>
250 </RequiredPrefixes>
251 </RequiredPrefixes>
251 </NamingRule>
252 </NamingRule>
252 <NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
253 <NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
253 <RequiredPrefixes>
254 <RequiredPrefixes>
254 <String>m_</String>
255 <String>m_</String>
255 </RequiredPrefixes>
256 </RequiredPrefixes>
256 </NamingRule>
257 </NamingRule>
257 <NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="AllUpper" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
258 <NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="AllUpper" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
258 <NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
259 <NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
259 <NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
260 <NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
260 <NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
261 <NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
261 <NamingRule Name="Parameters" AffectedEntity="Parameter, LocalVariable" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
262 <NamingRule Name="Parameters" AffectedEntity="Parameter, LocalVariable" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
262 <NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
263 <NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
263 <RequiredPrefixes>
264 <RequiredPrefixes>
264 <String>T</String>
265 <String>T</String>
265 </RequiredPrefixes>
266 </RequiredPrefixes>
266 </NamingRule>
267 </NamingRule>
267 </Rules>
268 </Rules>
268 </NameConventionPolicy>
269 </NameConventionPolicy>
269 </Policies>
270 </Policies>
270 </Properties>
271 </Properties>
271 </MonoDevelop>
272 </MonoDevelop>
272 </ProjectExtensions>
273 </ProjectExtensions>
273 <ItemGroup />
274 <ItemGroup />
274 </Project> No newline at end of file
275 </Project>
@@ -1,18 +1,21
1 using System.Threading;
1 using System;
2 using System;
2 using System.Collections.Generic;
3
3 using System.Linq;
4 namespace Implab {
4 using System.Text;
5 public class SyncContextPromise<T> : Promise<T> {
5 using System.Threading;
6 readonly SynchronizationContext m_context;
6
7
7 namespace Implab {
8 public SyncContextPromise(SynchronizationContext context) {
8 public class SyncContextPromise : Promise {
9 Safe.ArgumentNotNull(context, "context");
9 readonly SynchronizationContext m_context;
10 m_context = context;
10
11 }
11 public SyncContextPromise(SynchronizationContext context) {
12
12 Safe.ArgumentNotNull(context, "context");
13 protected override void SignalHandler(HandlerDescriptor handler, int signal) {
13
14 m_context.Post(x => base.SignalHandler(handler, signal), null);
14 m_context = context;
15 }
15 }
16 }
16
17 }
17 protected override void SignalHandler(HandlerDescriptor handler, int signal) {
18
18 m_context.Post(x => base.SignalHandler(handler, signal), null);
19 }
20 }
21 }
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

ok, latest stable version should be in default

You need to be logged in to leave comments. Login now