##// END OF EJS Templates
code cleanup
cin -
r91:cdaaf4792c22 v2
parent child
Show More
@@ -1,217 +1,216
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 </PropertyGroup>
10 </PropertyGroup>
11 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
11 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
12 <DebugSymbols>true</DebugSymbols>
12 <DebugSymbols>true</DebugSymbols>
13 <DebugType>full</DebugType>
13 <DebugType>full</DebugType>
14 <Optimize>false</Optimize>
14 <Optimize>false</Optimize>
15 <OutputPath>bin\Debug</OutputPath>
15 <OutputPath>bin\Debug</OutputPath>
16 <DefineConstants>TRACE;DEBUG;</DefineConstants>
16 <DefineConstants>TRACE;DEBUG;</DefineConstants>
17 <ErrorReport>prompt</ErrorReport>
17 <ErrorReport>prompt</ErrorReport>
18 <WarningLevel>4</WarningLevel>
18 <WarningLevel>4</WarningLevel>
19 <ConsolePause>false</ConsolePause>
19 <ConsolePause>false</ConsolePause>
20 <RunCodeAnalysis>true</RunCodeAnalysis>
20 <RunCodeAnalysis>true</RunCodeAnalysis>
21 </PropertyGroup>
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23 <DebugType>full</DebugType>
23 <DebugType>full</DebugType>
24 <Optimize>true</Optimize>
24 <Optimize>true</Optimize>
25 <OutputPath>bin\Release</OutputPath>
25 <OutputPath>bin\Release</OutputPath>
26 <ErrorReport>prompt</ErrorReport>
26 <ErrorReport>prompt</ErrorReport>
27 <WarningLevel>4</WarningLevel>
27 <WarningLevel>4</WarningLevel>
28 <ConsolePause>false</ConsolePause>
28 <ConsolePause>false</ConsolePause>
29 </PropertyGroup>
29 </PropertyGroup>
30 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' ">
30 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' ">
31 <DebugSymbols>true</DebugSymbols>
31 <DebugSymbols>true</DebugSymbols>
32 <DebugType>full</DebugType>
32 <DebugType>full</DebugType>
33 <Optimize>false</Optimize>
33 <Optimize>false</Optimize>
34 <OutputPath>bin\Debug</OutputPath>
34 <OutputPath>bin\Debug</OutputPath>
35 <DefineConstants>TRACE;DEBUG;NET_4_5</DefineConstants>
35 <DefineConstants>TRACE;DEBUG;NET_4_5</DefineConstants>
36 <ErrorReport>prompt</ErrorReport>
36 <ErrorReport>prompt</ErrorReport>
37 <WarningLevel>4</WarningLevel>
37 <WarningLevel>4</WarningLevel>
38 <RunCodeAnalysis>true</RunCodeAnalysis>
38 <RunCodeAnalysis>true</RunCodeAnalysis>
39 <ConsolePause>false</ConsolePause>
39 <ConsolePause>false</ConsolePause>
40 </PropertyGroup>
40 </PropertyGroup>
41 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
41 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' ">
42 <Optimize>true</Optimize>
42 <Optimize>true</Optimize>
43 <OutputPath>bin\Release</OutputPath>
43 <OutputPath>bin\Release</OutputPath>
44 <ErrorReport>prompt</ErrorReport>
44 <ErrorReport>prompt</ErrorReport>
45 <WarningLevel>4</WarningLevel>
45 <WarningLevel>4</WarningLevel>
46 <ConsolePause>false</ConsolePause>
46 <ConsolePause>false</ConsolePause>
47 <DefineConstants>NET_4_5</DefineConstants>
47 <DefineConstants>NET_4_5</DefineConstants>
48 </PropertyGroup>
48 </PropertyGroup>
49 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMono|AnyCPU' ">
49 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMono|AnyCPU' ">
50 <DebugSymbols>true</DebugSymbols>
50 <DebugSymbols>true</DebugSymbols>
51 <DebugType>full</DebugType>
51 <DebugType>full</DebugType>
52 <Optimize>false</Optimize>
52 <Optimize>false</Optimize>
53 <OutputPath>bin\Debug</OutputPath>
53 <OutputPath>bin\Debug</OutputPath>
54 <DefineConstants>TRACE;DEBUG;NET_4_5;MONO</DefineConstants>
54 <DefineConstants>TRACE;DEBUG;NET_4_5;MONO</DefineConstants>
55 <ErrorReport>prompt</ErrorReport>
55 <ErrorReport>prompt</ErrorReport>
56 <WarningLevel>4</WarningLevel>
56 <WarningLevel>4</WarningLevel>
57 <RunCodeAnalysis>true</RunCodeAnalysis>
57 <RunCodeAnalysis>true</RunCodeAnalysis>
58 <ConsolePause>false</ConsolePause>
58 <ConsolePause>false</ConsolePause>
59 </PropertyGroup>
59 </PropertyGroup>
60 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMono|AnyCPU' ">
60 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMono|AnyCPU' ">
61 <Optimize>true</Optimize>
61 <Optimize>true</Optimize>
62 <OutputPath>bin\Release</OutputPath>
62 <OutputPath>bin\Release</OutputPath>
63 <DefineConstants>NET_4_5;MONO;</DefineConstants>
63 <DefineConstants>NET_4_5;MONO;</DefineConstants>
64 <ErrorReport>prompt</ErrorReport>
64 <ErrorReport>prompt</ErrorReport>
65 <WarningLevel>4</WarningLevel>
65 <WarningLevel>4</WarningLevel>
66 <ConsolePause>false</ConsolePause>
66 <ConsolePause>false</ConsolePause>
67 </PropertyGroup>
67 </PropertyGroup>
68 <ItemGroup>
68 <ItemGroup>
69 <Reference Include="System" />
69 <Reference Include="System" />
70 <Reference Include="System.Xml" />
70 <Reference Include="System.Xml" />
71 </ItemGroup>
71 </ItemGroup>
72 <ItemGroup>
72 <ItemGroup>
73 <Compile Include="Component.cs" />
73 <Compile Include="Component.cs" />
74 <Compile Include="CustomEqualityComparer.cs" />
74 <Compile Include="CustomEqualityComparer.cs" />
75 <Compile Include="Diagnostics\ConsoleTraceListener.cs" />
75 <Compile Include="Diagnostics\ConsoleTraceListener.cs" />
76 <Compile Include="Diagnostics\EventText.cs" />
76 <Compile Include="Diagnostics\EventText.cs" />
77 <Compile Include="Diagnostics\IEventTextFormatter.cs" />
77 <Compile Include="Diagnostics\IEventTextFormatter.cs" />
78 <Compile Include="Diagnostics\LogChannel.cs" />
78 <Compile Include="Diagnostics\LogChannel.cs" />
79 <Compile Include="Diagnostics\LogicalOperation.cs" />
79 <Compile Include="Diagnostics\LogicalOperation.cs" />
80 <Compile Include="Diagnostics\TextFileListener.cs" />
80 <Compile Include="Diagnostics\TextFileListener.cs" />
81 <Compile Include="Diagnostics\TextListenerBase.cs" />
81 <Compile Include="Diagnostics\TextListenerBase.cs" />
82 <Compile Include="Diagnostics\TraceLog.cs" />
82 <Compile Include="Diagnostics\TraceLog.cs" />
83 <Compile Include="Diagnostics\TraceContext.cs" />
83 <Compile Include="Diagnostics\TraceContext.cs" />
84 <Compile Include="Diagnostics\TraceEvent.cs" />
84 <Compile Include="Diagnostics\TraceEvent.cs" />
85 <Compile Include="Diagnostics\TraceEventType.cs" />
85 <Compile Include="Diagnostics\TraceEventType.cs" />
86 <Compile Include="Disposable.cs" />
86 <Compile Include="Disposable.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="JSON\JSONElementContext.cs" />
94 <Compile Include="JSON\JSONElementContext.cs" />
95 <Compile Include="JSON\JSONElementType.cs" />
95 <Compile Include="JSON\JSONElementType.cs" />
96 <Compile Include="JSON\JSONGrammar.cs" />
96 <Compile Include="JSON\JSONGrammar.cs" />
97 <Compile Include="JSON\JSONParser.cs" />
97 <Compile Include="JSON\JSONParser.cs" />
98 <Compile Include="JSON\JSONScanner.cs" />
98 <Compile Include="JSON\JSONScanner.cs" />
99 <Compile Include="JSON\JsonTokenType.cs" />
99 <Compile Include="JSON\JsonTokenType.cs" />
100 <Compile Include="JSON\JSONWriter.cs" />
100 <Compile Include="JSON\JSONWriter.cs" />
101 <Compile Include="JSON\JSONXmlReader.cs" />
101 <Compile Include="JSON\JSONXmlReader.cs" />
102 <Compile Include="JSON\JSONXmlReaderOptions.cs" />
102 <Compile Include="JSON\JSONXmlReaderOptions.cs" />
103 <Compile Include="JSON\StringTranslator.cs" />
103 <Compile Include="JSON\StringTranslator.cs" />
104 <Compile Include="Parallels\DispatchPool.cs" />
104 <Compile Include="Parallels\DispatchPool.cs" />
105 <Compile Include="Parallels\ArrayTraits.cs" />
105 <Compile Include="Parallels\ArrayTraits.cs" />
106 <Compile Include="Parallels\MTQueue.cs" />
106 <Compile Include="Parallels\MTQueue.cs" />
107 <Compile Include="Parallels\WorkerPool.cs" />
107 <Compile Include="Parallels\WorkerPool.cs" />
108 <Compile Include="Parsing\Alphabet.cs" />
108 <Compile Include="Parsing\Alphabet.cs" />
109 <Compile Include="Parsing\AlphabetBase.cs" />
109 <Compile Include="Parsing\AlphabetBase.cs" />
110 <Compile Include="Parsing\AltToken.cs" />
110 <Compile Include="Parsing\AltToken.cs" />
111 <Compile Include="Parsing\BinaryToken.cs" />
111 <Compile Include="Parsing\BinaryToken.cs" />
112 <Compile Include="Parsing\CatToken.cs" />
112 <Compile Include="Parsing\CatToken.cs" />
113 <Compile Include="Parsing\CDFADefinition.cs" />
113 <Compile Include="Parsing\CDFADefinition.cs" />
114 <Compile Include="Parsing\DFABuilder.cs" />
114 <Compile Include="Parsing\DFABuilder.cs" />
115 <Compile Include="Parsing\DFADefinitionBase.cs" />
115 <Compile Include="Parsing\DFADefinitionBase.cs" />
116 <Compile Include="Parsing\DFAStateDescriptor.cs" />
116 <Compile Include="Parsing\DFAStateDescriptor.cs" />
117 <Compile Include="Parsing\DFAutomaton.cs" />
117 <Compile Include="Parsing\DFAutomaton.cs" />
118 <Compile Include="Parsing\EDFADefinition.cs" />
118 <Compile Include="Parsing\EDFADefinition.cs" />
119 <Compile Include="Parsing\EmptyToken.cs" />
119 <Compile Include="Parsing\EmptyToken.cs" />
120 <Compile Include="Parsing\EndToken.cs" />
120 <Compile Include="Parsing\EndToken.cs" />
121 <Compile Include="Parsing\EnumAlphabet.cs" />
121 <Compile Include="Parsing\EnumAlphabet.cs" />
122 <Compile Include="Parsing\Grammar.cs" />
122 <Compile Include="Parsing\Grammar.cs" />
123 <Compile Include="Parsing\IAlphabet.cs" />
123 <Compile Include="Parsing\IAlphabet.cs" />
124 <Compile Include="Parsing\IDFADefinition.cs" />
124 <Compile Include="Parsing\IDFADefinition.cs" />
125 <Compile Include="Parsing\IVisitor.cs" />
125 <Compile Include="Parsing\IVisitor.cs" />
126 <Compile Include="Parsing\ParserException.cs" />
126 <Compile Include="Parsing\ParserException.cs" />
127 <Compile Include="Parsing\Scanner.cs" />
127 <Compile Include="Parsing\Scanner.cs" />
128 <Compile Include="Parsing\StarToken.cs" />
128 <Compile Include="Parsing\StarToken.cs" />
129 <Compile Include="Parsing\SymbolToken.cs" />
129 <Compile Include="Parsing\SymbolToken.cs" />
130 <Compile Include="Parsing\Token.cs" />
130 <Compile Include="Parsing\Token.cs" />
131 <Compile Include="SafePool.cs" />
131 <Compile Include="SafePool.cs" />
132 <Compile Include="ServiceLocator.cs" />
132 <Compile Include="ServiceLocator.cs" />
133 <Compile Include="TaskController.cs" />
133 <Compile Include="TaskController.cs" />
134 <Compile Include="ProgressInitEventArgs.cs" />
134 <Compile Include="ProgressInitEventArgs.cs" />
135 <Compile Include="Properties\AssemblyInfo.cs" />
135 <Compile Include="Properties\AssemblyInfo.cs" />
136 <Compile Include="Promise.cs" />
136 <Compile Include="Promise.cs" />
137 <Compile Include="Parallels\AsyncPool.cs" />
137 <Compile Include="Parallels\AsyncPool.cs" />
138 <Compile Include="Safe.cs" />
138 <Compile Include="Safe.cs" />
139 <Compile Include="ValueEventArgs.cs" />
139 <Compile Include="ValueEventArgs.cs" />
140 <Compile Include="PromiseExtensions.cs" />
140 <Compile Include="PromiseExtensions.cs" />
141 <Compile Include="TransientPromiseException.cs" />
141 <Compile Include="TransientPromiseException.cs" />
142 <Compile Include="SyncContextPromise.cs" />
142 <Compile Include="SyncContextPromise.cs" />
143 <Compile Include="ObjectPool.cs" />
143 <Compile Include="ObjectPool.cs" />
144 <Compile Include="ObjectPoolWrapper.cs" />
145 </ItemGroup>
144 </ItemGroup>
146 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
145 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
147 <ItemGroup />
146 <ItemGroup />
148 <ProjectExtensions>
147 <ProjectExtensions>
149 <MonoDevelop>
148 <MonoDevelop>
150 <Properties>
149 <Properties>
151 <Policies>
150 <Policies>
152 <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" />
151 <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" />
153 <TextStylePolicy FileWidth="120" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
152 <TextStylePolicy FileWidth="120" EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
154 <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" />
153 <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" />
155 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" />
154 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" />
156 <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
155 <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
157 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
156 <TextStylePolicy FileWidth="120" TabsToSpaces="False" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
158 <NameConventionPolicy>
157 <NameConventionPolicy>
159 <Rules>
158 <Rules>
160 <NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
159 <NamingRule Name="Namespaces" AffectedEntity="Namespace" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
161 <NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
160 <NamingRule Name="Types" AffectedEntity="Class, Struct, Enum, Delegate" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
162 <NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
161 <NamingRule Name="Interfaces" AffectedEntity="Interface" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
163 <RequiredPrefixes>
162 <RequiredPrefixes>
164 <String>I</String>
163 <String>I</String>
165 </RequiredPrefixes>
164 </RequiredPrefixes>
166 </NamingRule>
165 </NamingRule>
167 <NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
166 <NamingRule Name="Attributes" AffectedEntity="CustomAttributes" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
168 <RequiredSuffixes>
167 <RequiredSuffixes>
169 <String>Attribute</String>
168 <String>Attribute</String>
170 </RequiredSuffixes>
169 </RequiredSuffixes>
171 </NamingRule>
170 </NamingRule>
172 <NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
171 <NamingRule Name="Event Arguments" AffectedEntity="CustomEventArgs" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
173 <RequiredSuffixes>
172 <RequiredSuffixes>
174 <String>EventArgs</String>
173 <String>EventArgs</String>
175 </RequiredSuffixes>
174 </RequiredSuffixes>
176 </NamingRule>
175 </NamingRule>
177 <NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
176 <NamingRule Name="Exceptions" AffectedEntity="CustomExceptions" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
178 <RequiredSuffixes>
177 <RequiredSuffixes>
179 <String>Exception</String>
178 <String>Exception</String>
180 </RequiredSuffixes>
179 </RequiredSuffixes>
181 </NamingRule>
180 </NamingRule>
182 <NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
181 <NamingRule Name="Methods" AffectedEntity="Methods" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
183 <NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
182 <NamingRule Name="Static Readonly Fields" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Protected, Public" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True" />
184 <NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
183 <NamingRule Name="Fields (Non Private)" AffectedEntity="Field" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
185 <NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" />
184 <NamingRule Name="ReadOnly Fields (Non Private)" AffectedEntity="ReadonlyField" VisibilityMask="Internal, Public" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False" />
186 <NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
185 <NamingRule Name="Fields (Private)" AffectedEntity="Field, ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
187 <RequiredPrefixes>
186 <RequiredPrefixes>
188 <String>m_</String>
187 <String>m_</String>
189 </RequiredPrefixes>
188 </RequiredPrefixes>
190 </NamingRule>
189 </NamingRule>
191 <NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True">
190 <NamingRule Name="Static Fields (Private)" AffectedEntity="Field" VisibilityMask="Private" NamingStyle="CamelCase" IncludeInstanceMembers="False" IncludeStaticEntities="True">
192 <RequiredPrefixes>
191 <RequiredPrefixes>
193 <String>_</String>
192 <String>_</String>
194 </RequiredPrefixes>
193 </RequiredPrefixes>
195 </NamingRule>
194 </NamingRule>
196 <NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
195 <NamingRule Name="ReadOnly Fields (Private)" AffectedEntity="ReadonlyField" VisibilityMask="Private, Protected" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="False">
197 <RequiredPrefixes>
196 <RequiredPrefixes>
198 <String>m_</String>
197 <String>m_</String>
199 </RequiredPrefixes>
198 </RequiredPrefixes>
200 </NamingRule>
199 </NamingRule>
201 <NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="AllUpper" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
200 <NamingRule Name="Constant Fields" AffectedEntity="ConstantField" VisibilityMask="VisibilityMask" NamingStyle="AllUpper" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
202 <NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
201 <NamingRule Name="Properties" AffectedEntity="Property" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
203 <NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
202 <NamingRule Name="Events" AffectedEntity="Event" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
204 <NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
203 <NamingRule Name="Enum Members" AffectedEntity="EnumMember" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
205 <NamingRule Name="Parameters" AffectedEntity="Parameter, LocalVariable" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
204 <NamingRule Name="Parameters" AffectedEntity="Parameter, LocalVariable" VisibilityMask="VisibilityMask" NamingStyle="CamelCase" IncludeInstanceMembers="True" IncludeStaticEntities="True" />
206 <NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
205 <NamingRule Name="Type Parameters" AffectedEntity="TypeParameter" VisibilityMask="VisibilityMask" NamingStyle="PascalCase" IncludeInstanceMembers="True" IncludeStaticEntities="True">
207 <RequiredPrefixes>
206 <RequiredPrefixes>
208 <String>T</String>
207 <String>T</String>
209 </RequiredPrefixes>
208 </RequiredPrefixes>
210 </NamingRule>
209 </NamingRule>
211 </Rules>
210 </Rules>
212 </NameConventionPolicy>
211 </NameConventionPolicy>
213 </Policies>
212 </Policies>
214 </Properties>
213 </Properties>
215 </MonoDevelop>
214 </MonoDevelop>
216 </ProjectExtensions>
215 </ProjectExtensions>
217 </Project> No newline at end of file
216 </Project>
@@ -1,95 +1,90
1 using System;
1 using System;
2 using Implab.Parallels;
2 using Implab.Parallels;
3 using System.Threading;
3 using System.Threading;
4 using System.Diagnostics;
4 using System.Diagnostics;
5 using System.Diagnostics.CodeAnalysis;
5 using System.Diagnostics.CodeAnalysis;
6
6
7 namespace Implab {
7 namespace Implab {
8 public abstract class ObjectPool<T> : IDisposable {
8 public abstract class ObjectPool<T> : IDisposable {
9 readonly int m_size;
9 readonly int m_size;
10 readonly MTQueue<T> m_queue = new MTQueue<T>();
10 readonly MTQueue<T> m_queue = new MTQueue<T>();
11
11
12 [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
12 [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
13 static readonly bool _isValueType = typeof(T).IsValueType;
13 static readonly bool _isValueType = typeof(T).IsValueType;
14
14
15 bool m_disposed;
15 bool m_disposed;
16
16
17 int m_count;
17 int m_count;
18
18
19 protected ObjectPool(int size) {
19 protected ObjectPool(int size) {
20 m_size = size;
20 m_size = size;
21 }
21 }
22
22
23 protected ObjectPool() : this(Environment.ProcessorCount+1) {
23 protected ObjectPool() : this(Environment.ProcessorCount+1) {
24 }
24 }
25
25
26 public ObjectPoolWrapper<T> AllocateAuto() {
27
28 return new ObjectPoolWrapper<T>(Allocate(), this);
29 }
30
31 public T Allocate() {
26 public T Allocate() {
32 if (m_disposed)
27 if (m_disposed)
33 throw new ObjectDisposedException(ToString());
28 throw new ObjectDisposedException(ToString());
34
29
35 T instance;
30 T instance;
36 if (m_queue.TryDequeue(out instance)) {
31 if (m_queue.TryDequeue(out instance)) {
37 Interlocked.Decrement(ref m_count);
32 Interlocked.Decrement(ref m_count);
38 } else {
33 } else {
39 instance = CreateInstance();
34 instance = CreateInstance();
40 Debug.Assert(!Object.Equals(instance, default(T)) || _isValueType);
35 Debug.Assert(!Object.Equals(instance, default(T)) || _isValueType);
41 }
36 }
42 return instance;
37 return instance;
43 }
38 }
44
39
45 protected abstract T CreateInstance();
40 protected abstract T CreateInstance();
46
41
47 protected virtual void CleanupInstance(T instance) {
42 protected virtual void CleanupInstance(T instance) {
48 }
43 }
49
44
50 public void Release(T instance) {
45 public void Release(T instance) {
51 if ( Object.Equals(instance,default(T)) && !_isValueType)
46 if ( Object.Equals(instance,default(T)) && !_isValueType)
52 return;
47 return;
53
48
54 Thread.MemoryBarrier();
49 Thread.MemoryBarrier();
55 if (m_count < m_size && !m_disposed) {
50 if (m_count < m_size && !m_disposed) {
56 Interlocked.Increment(ref m_count);
51 Interlocked.Increment(ref m_count);
57
52
58 CleanupInstance(instance);
53 CleanupInstance(instance);
59
54
60 m_queue.Enqueue(instance);
55 m_queue.Enqueue(instance);
61
56
62 // пока элемент возвращался в кеш, была начата операция освобождения всего кеша
57 // пока элемент возвращался в кеш, была начата операция освобождения всего кеша
63 // и возможно уже законцена, в таком случае следует извлечь элемент обратно и
58 // и возможно уже законцена, в таком случае следует извлечь элемент обратно и
64 // освободить его. Если операция освобождения кеша еще не заврешилась, то будет
59 // освободить его. Если операция освобождения кеша еще не заврешилась, то будет
65 // изъят и освобожден произвольный элемен, что не повлияет на ход всего процесса.
60 // изъят и освобожден произвольный элемен, что не повлияет на ход всего процесса.
66 if (m_disposed && m_queue.TryDequeue(out instance) && instance is IDisposable)
61 if (m_disposed && m_queue.TryDequeue(out instance) && instance is IDisposable)
67 ((IDisposable)instance).Dispose() ;
62 ((IDisposable)instance).Dispose() ;
68
63
69 } else {
64 } else {
70 if (instance is IDisposable)
65 if (instance is IDisposable)
71 ((IDisposable)instance).Dispose();
66 ((IDisposable)instance).Dispose();
72 }
67 }
73 }
68 }
74
69
75 protected virtual void Dispose(bool disposing) {
70 protected virtual void Dispose(bool disposing) {
76 if (disposing) {
71 if (disposing) {
77 m_disposed = true;
72 m_disposed = true;
78 T instance;
73 T instance;
79 while (m_queue.TryDequeue(out instance))
74 while (m_queue.TryDequeue(out instance))
80 if (instance is IDisposable)
75 if (instance is IDisposable)
81 ((IDisposable)instance).Dispose();
76 ((IDisposable)instance).Dispose();
82 }
77 }
83 }
78 }
84
79
85 #region IDisposable implementation
80 #region IDisposable implementation
86
81
87 public void Dispose() {
82 public void Dispose() {
88 Dispose(true);
83 Dispose(true);
89 GC.SuppressFinalize(this);
84 GC.SuppressFinalize(this);
90 }
85 }
91
86
92 #endregion
87 #endregion
93 }
88 }
94 }
89 }
95
90
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now