Auto status change to "Under Review"
@@ -0,0 +1,17 | |||
|
1 | <?xml version="1.0"?> | |
|
2 | <package > | |
|
3 | <metadata> | |
|
4 | <id>Implab</id> | |
|
5 | <version>$version$</version> | |
|
6 | <title>$title$</title> | |
|
7 | <authors>Implab team</authors> | |
|
8 | <owners>Implab team</owners> | |
|
9 | <projectUrl>https://implab.org/</projectUrl> | |
|
10 | <!-- <iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl> --> | |
|
11 | <requireLicenseAcceptance>false</requireLicenseAcceptance> | |
|
12 | <description>Common components for asynchronous applications, tracing, logging, json and xml traits.</description> | |
|
13 | <releaseNotes>Added strong name.</releaseNotes> | |
|
14 | <copyright>Copyright 2017</copyright> | |
|
15 | <tags>async xml json</tags> | |
|
16 | </metadata> | |
|
17 | </package> No newline at end of file |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,22 | |||
|
1 | Copyright 2012 Sergey Smirnov | |
|
2 | ||
|
3 | Redistribution and use in source and binary forms, with or without | |
|
4 | modification, are permitted provided that the following conditions are met: | |
|
5 | ||
|
6 | 1. Redistributions of source code must retain the above copyright notice, this | |
|
7 | list of conditions and the following disclaimer. | |
|
8 | ||
|
9 | 2. Redistributions in binary form must reproduce the above copyright notice, | |
|
10 | this list of conditions and the following disclaimer in the documentation | |
|
11 | and/or other materials provided with the distribution. | |
|
12 | ||
|
13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |
|
14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
|
15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
|
16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |
|
17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
|
18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
|
19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
|
20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
|
21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
|
22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. No newline at end of file |
@@ -49,7 +49,6 namespace Implab.Playground { | |||
|
49 | 49 | return actual != 0; |
|
50 | 50 | } |
|
51 | 51 | |
|
52 | /* | |
|
53 | 52 | static void EnqueueRange<T>(AsyncQueue<T> q, T[] data, int offset, int len) { |
|
54 | 53 | for (var i = offset; i < offset + len; i++) |
|
55 | 54 | q.Enqueue(data[i]); |
@@ -66,15 +65,15 namespace Implab.Playground { | |||
|
66 | 65 | } |
|
67 | 66 | return actual != 0; |
|
68 | 67 | } |
|
69 |
|
|
|
68 | ||
|
70 | 69 | |
|
71 | static void EnqueueRange<T>(AsyncQueue<T> q, T[] data, int offset, int len) { | |
|
70 | /*static void EnqueueRange<T>(AsyncQueue<T> q, T[] data, int offset, int len) { | |
|
72 | 71 | q.EnqueueRange(data, offset, len); |
|
73 | 72 | } |
|
74 | 73 |
|
|
75 | 74 | static bool TryDequeueRange<T>(AsyncQueue<T> q, T[] buffer, int offset, int len, out int actual) { |
|
76 | 75 | return q.TryDequeueRange(buffer, offset, len, out actual); |
|
77 |
|
|
|
76 | }*/ | |
|
78 | 77 | |
|
79 | 78 | |
|
80 | 79 | static void Main(string[] args) { |
@@ -67,6 +67,12 | |||
|
67 | 67 | <WarningLevel>4</WarningLevel> |
|
68 | 68 | <ConsolePause>false</ConsolePause> |
|
69 | 69 | </PropertyGroup> |
|
70 | <PropertyGroup> | |
|
71 | <SignAssembly>true</SignAssembly> | |
|
72 | </PropertyGroup> | |
|
73 | <PropertyGroup> | |
|
74 | <AssemblyOriginatorKeyFile>implab.snk</AssemblyOriginatorKeyFile> | |
|
75 | </PropertyGroup> | |
|
70 | 76 | <ItemGroup> |
|
71 | 77 | <Reference Include="System" /> |
|
72 | 78 | <Reference Include="System.Xml" /> |
@@ -207,7 +213,12 | |||
|
207 | 213 | <Compile Include="Xml\XmlNameContext.cs" /> |
|
208 | 214 | </ItemGroup> |
|
209 | 215 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
|
210 |
<ItemGroup |
|
|
216 | <ItemGroup> | |
|
217 | <None Include="Implab.nuspec"> | |
|
218 | <SubType>Designer</SubType> | |
|
219 | </None> | |
|
220 | <None Include="implab.snk" /> | |
|
221 | </ItemGroup> | |
|
211 | 222 | <ProjectExtensions> |
|
212 | 223 | <MonoDevelop> |
|
213 | 224 | <Properties> |
@@ -279,5 +290,7 | |||
|
279 | 290 | </Properties> |
|
280 | 291 | </MonoDevelop> |
|
281 | 292 | </ProjectExtensions> |
|
282 |
<ItemGroup |
|
|
293 | <ItemGroup> | |
|
294 | <Content Include="license.txt" /> | |
|
295 | </ItemGroup> | |
|
283 | 296 | </Project> No newline at end of file |
@@ -3,6 +3,7 using System.Collections.Generic; | |||
|
3 | 3 | using System; |
|
4 | 4 | using System.Collections; |
|
5 | 5 | using System.Diagnostics; |
|
6 | using System.Runtime.CompilerServices; | |
|
6 | 7 | |
|
7 | 8 | namespace Implab.Parallels { |
|
8 | 9 | public class AsyncQueue<T> : IEnumerable<T> { |
@@ -51,6 +52,16 namespace Implab.Parallels { | |||
|
51 | 52 | get { return m_size; } |
|
52 | 53 | } |
|
53 | 54 | |
|
55 | [MethodImpl(MethodImplOptions.AggressiveInlining)] | |
|
56 | void AwaitWrites(int mark) { | |
|
57 | if (m_hi != mark) { | |
|
58 | SpinWait spin = new SpinWait(); | |
|
59 | do { | |
|
60 | spin.SpinOnce(); | |
|
61 | } while (m_hi != mark); | |
|
62 | } | |
|
63 | } | |
|
64 | ||
|
54 | 65 | public bool TryEnqueue(T value) { |
|
55 | 66 | int alloc; |
|
56 | 67 | do { |
@@ -61,12 +72,7 namespace Implab.Parallels { | |||
|
61 | 72 | |
|
62 | 73 | m_data[alloc] = value; |
|
63 | 74 | |
|
64 |
|
|
|
65 | // m_hi is volatile | |
|
66 | while (alloc != m_hi) { | |
|
67 | // spin wait for commit | |
|
68 | spin.SpinOnce(); | |
|
69 | } | |
|
75 | AwaitWrites(alloc); | |
|
70 | 76 | m_hi = alloc + 1; |
|
71 | 77 | |
|
72 | 78 | return true; |
@@ -77,10 +83,7 namespace Implab.Parallels { | |||
|
77 | 83 | /// </summary> |
|
78 | 84 | public void Seal() { |
|
79 | 85 | var actual = Math.Min(Interlocked.Exchange(ref m_alloc, m_size), m_size); |
|
80 |
|
|
|
81 | while (m_hi != actual) { | |
|
82 | spin.SpinOnce(); | |
|
83 | } | |
|
86 | AwaitWrites(actual); | |
|
84 | 87 | } |
|
85 | 88 | |
|
86 | 89 | public bool TryDequeue(out T value, out bool recycle) { |
@@ -114,11 +117,7 namespace Implab.Parallels { | |||
|
114 | 117 | |
|
115 | 118 | Array.Copy(batch, offset, m_data, alloc, enqueued); |
|
116 | 119 | |
|
117 |
|
|
|
118 | while (alloc != m_hi) { | |
|
119 | spin.SpinOnce(); | |
|
120 | } | |
|
121 | ||
|
120 | AwaitWrites(alloc); | |
|
122 | 121 | m_hi = alloc + enqueued; |
|
123 | 122 | return true; |
|
124 | 123 | } |
@@ -361,9 +360,7 namespace Implab.Parallels { | |||
|
361 | 360 | } |
|
362 | 361 | |
|
363 | 362 | public List<T> Drain() { |
|
364 | // start the new queue | |
|
365 | var chunk = new Chunk(DEFAULT_CHUNK_SIZE); | |
|
366 | ||
|
363 | Chunk chunk = null; | |
|
367 | 364 | do { |
|
368 | 365 | var first = m_first; |
|
369 | 366 | // first.next is volatile |
@@ -374,6 +371,10 namespace Implab.Parallels { | |||
|
374 | 371 | return new List<T>(); |
|
375 | 372 | } |
|
376 | 373 | |
|
374 | // start the new queue | |
|
375 | if (chunk == null) | |
|
376 | chunk = new Chunk(DEFAULT_CHUNK_SIZE); | |
|
377 | ||
|
377 | 378 | // here we will create inconsistency which will force others to spin |
|
378 | 379 | // and prevent from fetching. chunk.next = null |
|
379 | 380 | if (first != Interlocked.CompareExchange(ref m_first, chunk, first)) |
@@ -1,5 +1,4 | |||
|
1 | 1 | using System.Reflection; |
|
2 | using System.Runtime.CompilerServices; | |
|
3 | 2 | using System.Runtime.InteropServices; |
|
4 | 3 | |
|
5 | 4 | // Information about this assembly is defined by the following attributes. |
@@ -7,11 +6,9 using System.Runtime.InteropServices; | |||
|
7 | 6 | |
|
8 | 7 | [assembly: AssemblyTitle("Implab")] |
|
9 | 8 | [assembly: AssemblyDescription("Tools")] |
|
10 |
[assembly: AssemblyCo |
|
|
11 | [assembly: AssemblyCompany("")] | |
|
12 | [assembly: AssemblyProduct("")] | |
|
9 | [assembly: AssemblyCompany("Implab.org")] | |
|
13 | 10 | [assembly: AssemblyCopyright("Implab")] |
|
14 | [assembly: AssemblyTrademark("")] | |
|
11 | [assembly: AssemblyTrademark("Implab")] | |
|
15 | 12 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". |
|
16 | 13 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, |
|
17 | 14 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. |
General Comments 3
ok, latest stable version should be in default
You need to be logged in to leave comments.
Login now