##// END OF EJS Templates
Added implab nuget spec
cin -
r234:8dd666e6b6bf v2
parent child
Show More
@@ -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
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 return actual != 0;
49 return actual != 0;
50 }
50 }
51
51
52 /*
53 static void EnqueueRange<T>(AsyncQueue<T> q, T[] data, int offset, int len) {
52 static void EnqueueRange<T>(AsyncQueue<T> q, T[] data, int offset, int len) {
54 for (var i = offset; i < offset + len; i++)
53 for (var i = offset; i < offset + len; i++)
55 q.Enqueue(data[i]);
54 q.Enqueue(data[i]);
@@ -66,15 +65,15 namespace Implab.Playground {
66 }
65 }
67 return actual != 0;
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 q.EnqueueRange(data, offset, len);
71 q.EnqueueRange(data, offset, len);
73 }
72 }
74
73
75 static bool TryDequeueRange<T>(AsyncQueue<T> q, T[] buffer, int offset, int len, out int actual) {
74 static bool TryDequeueRange<T>(AsyncQueue<T> q, T[] buffer, int offset, int len, out int actual) {
76 return q.TryDequeueRange(buffer, offset, len, out actual);
75 return q.TryDequeueRange(buffer, offset, len, out actual);
77 }
76 }*/
78
77
79
78
80 static void Main(string[] args) {
79 static void Main(string[] args) {
@@ -67,6 +67,12
67 <WarningLevel>4</WarningLevel>
67 <WarningLevel>4</WarningLevel>
68 <ConsolePause>false</ConsolePause>
68 <ConsolePause>false</ConsolePause>
69 </PropertyGroup>
69 </PropertyGroup>
70 <PropertyGroup>
71 <SignAssembly>true</SignAssembly>
72 </PropertyGroup>
73 <PropertyGroup>
74 <AssemblyOriginatorKeyFile>implab.snk</AssemblyOriginatorKeyFile>
75 </PropertyGroup>
70 <ItemGroup>
76 <ItemGroup>
71 <Reference Include="System" />
77 <Reference Include="System" />
72 <Reference Include="System.Xml" />
78 <Reference Include="System.Xml" />
@@ -207,7 +213,12
207 <Compile Include="Xml\XmlNameContext.cs" />
213 <Compile Include="Xml\XmlNameContext.cs" />
208 </ItemGroup>
214 </ItemGroup>
209 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
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 <ProjectExtensions>
222 <ProjectExtensions>
212 <MonoDevelop>
223 <MonoDevelop>
213 <Properties>
224 <Properties>
@@ -279,5 +290,7
279 </Properties>
290 </Properties>
280 </MonoDevelop>
291 </MonoDevelop>
281 </ProjectExtensions>
292 </ProjectExtensions>
282 <ItemGroup />
293 <ItemGroup>
294 <Content Include="license.txt" />
295 </ItemGroup>
283 </Project> No newline at end of file
296 </Project>
@@ -3,6 +3,7 using System.Collections.Generic;
3 using System;
3 using System;
4 using System.Collections;
4 using System.Collections;
5 using System.Diagnostics;
5 using System.Diagnostics;
6 using System.Runtime.CompilerServices;
6
7
7 namespace Implab.Parallels {
8 namespace Implab.Parallels {
8 public class AsyncQueue<T> : IEnumerable<T> {
9 public class AsyncQueue<T> : IEnumerable<T> {
@@ -51,6 +52,16 namespace Implab.Parallels {
51 get { return m_size; }
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 public bool TryEnqueue(T value) {
65 public bool TryEnqueue(T value) {
55 int alloc;
66 int alloc;
56 do {
67 do {
@@ -61,12 +72,7 namespace Implab.Parallels {
61
72
62 m_data[alloc] = value;
73 m_data[alloc] = value;
63
74
64 SpinWait spin = new SpinWait();
75 AwaitWrites(alloc);
65 // m_hi is volatile
66 while (alloc != m_hi) {
67 // spin wait for commit
68 spin.SpinOnce();
69 }
70 m_hi = alloc + 1;
76 m_hi = alloc + 1;
71
77
72 return true;
78 return true;
@@ -77,10 +83,7 namespace Implab.Parallels {
77 /// </summary>
83 /// </summary>
78 public void Seal() {
84 public void Seal() {
79 var actual = Math.Min(Interlocked.Exchange(ref m_alloc, m_size), m_size);
85 var actual = Math.Min(Interlocked.Exchange(ref m_alloc, m_size), m_size);
80 SpinWait spin = new SpinWait();
86 AwaitWrites(actual);
81 while (m_hi != actual) {
82 spin.SpinOnce();
83 }
84 }
87 }
85
88
86 public bool TryDequeue(out T value, out bool recycle) {
89 public bool TryDequeue(out T value, out bool recycle) {
@@ -114,11 +117,7 namespace Implab.Parallels {
114
117
115 Array.Copy(batch, offset, m_data, alloc, enqueued);
118 Array.Copy(batch, offset, m_data, alloc, enqueued);
116
119
117 SpinWait spin = new SpinWait();
120 AwaitWrites(alloc);
118 while (alloc != m_hi) {
119 spin.SpinOnce();
120 }
121
122 m_hi = alloc + enqueued;
121 m_hi = alloc + enqueued;
123 return true;
122 return true;
124 }
123 }
@@ -361,9 +360,7 namespace Implab.Parallels {
361 }
360 }
362
361
363 public List<T> Drain() {
362 public List<T> Drain() {
364 // start the new queue
363 Chunk chunk = null;
365 var chunk = new Chunk(DEFAULT_CHUNK_SIZE);
366
367 do {
364 do {
368 var first = m_first;
365 var first = m_first;
369 // first.next is volatile
366 // first.next is volatile
@@ -374,6 +371,10 namespace Implab.Parallels {
374 return new List<T>();
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 // here we will create inconsistency which will force others to spin
378 // here we will create inconsistency which will force others to spin
378 // and prevent from fetching. chunk.next = null
379 // and prevent from fetching. chunk.next = null
379 if (first != Interlocked.CompareExchange(ref m_first, chunk, first))
380 if (first != Interlocked.CompareExchange(ref m_first, chunk, first))
@@ -1,5 +1,4
1 using System.Reflection;
1 using System.Reflection;
2 using System.Runtime.CompilerServices;
3 using System.Runtime.InteropServices;
2 using System.Runtime.InteropServices;
4
3
5 // Information about this assembly is defined by the following attributes.
4 // Information about this assembly is defined by the following attributes.
@@ -7,11 +6,9 using System.Runtime.InteropServices;
7
6
8 [assembly: AssemblyTitle("Implab")]
7 [assembly: AssemblyTitle("Implab")]
9 [assembly: AssemblyDescription("Tools")]
8 [assembly: AssemblyDescription("Tools")]
10 [assembly: AssemblyConfiguration("")]
9 [assembly: AssemblyCompany("Implab.org")]
11 [assembly: AssemblyCompany("")]
12 [assembly: AssemblyProduct("")]
13 [assembly: AssemblyCopyright("Implab")]
10 [assembly: AssemblyCopyright("Implab")]
14 [assembly: AssemblyTrademark("")]
11 [assembly: AssemblyTrademark("Implab")]
15 // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
12 // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
16 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
13 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
17 // and "{Major}.{Minor}.{Build}.*" will update just the revision.
14 // and "{Major}.{Minor}.{Build}.*" will update just the revision.
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