diff --git a/Modbus.Net/Modbus.Net.Modbus/Modbus.Net.Modbus.csproj b/Modbus.Net/Modbus.Net.Modbus/Modbus.Net.Modbus.csproj
index 72489de..1fee670 100644
--- a/Modbus.Net/Modbus.Net.Modbus/Modbus.Net.Modbus.csproj
+++ b/Modbus.Net/Modbus.Net.Modbus/Modbus.Net.Modbus.csproj
@@ -16,6 +16,7 @@
https://github.com/parallelbgls/Modbus.Net
git
hardware communicate protocal modbus Delian
+ True
diff --git a/Modbus.Net/Modbus.Net.OPC/Modbus.Net.OPC.csproj b/Modbus.Net/Modbus.Net.OPC/Modbus.Net.OPC.csproj
index 2b73a3f..743be02 100644
--- a/Modbus.Net/Modbus.Net.OPC/Modbus.Net.OPC.csproj
+++ b/Modbus.Net/Modbus.Net.OPC/Modbus.Net.OPC.csproj
@@ -15,6 +15,8 @@
https://github.com/parallelbgls/Modbus.Net
git
hardware communicate protocal OPC DA Delian
+ False
+ True
diff --git a/Modbus.Net/Modbus.Net.Siemens/Modbus.Net.Siemens.csproj b/Modbus.Net/Modbus.Net.Siemens/Modbus.Net.Siemens.csproj
index 004dd33..2caf351 100644
--- a/Modbus.Net/Modbus.Net.Siemens/Modbus.Net.Siemens.csproj
+++ b/Modbus.Net/Modbus.Net.Siemens/Modbus.Net.Siemens.csproj
@@ -15,6 +15,7 @@
https://github.com/parallelbgls/Modbus.Net
git
hardware communicate protocal Siemens profinet Delian
+ True
diff --git a/Modbus.Net/Modbus.Net.Standard/Modbus.Net.Core.csproj b/Modbus.Net/Modbus.Net.Standard/Modbus.Net.Core.csproj
index 48a228a..70037fd 100644
--- a/Modbus.Net/Modbus.Net.Standard/Modbus.Net.Core.csproj
+++ b/Modbus.Net/Modbus.Net.Standard/Modbus.Net.Core.csproj
@@ -16,6 +16,8 @@
Copyright 2017 Hangzhou Delian IoT Science Technology Co.,Ltd.
hardware communicate protocal Delian
git
+ False
+ True
diff --git a/Modbus.Net/Modbus.Net/Modbus.Net.csproj b/Modbus.Net/Modbus.Net/Modbus.Net.csproj
index 146e8e0..9579579 100644
--- a/Modbus.Net/Modbus.Net/Modbus.Net.csproj
+++ b/Modbus.Net/Modbus.Net/Modbus.Net.csproj
@@ -16,6 +16,7 @@
Copyright 2017 Hangzhou Delian IoT Science Technology Co.,Ltd.
hardware communicate protocal Delian
git
+ True
diff --git a/Modbus.Net/src/Base.Common/AsyncHelper.cs b/Modbus.Net/src/Base.Common/AsyncHelper.cs
index 332d636..456c170 100644
--- a/Modbus.Net/src/Base.Common/AsyncHelper.cs
+++ b/Modbus.Net/src/Base.Common/AsyncHelper.cs
@@ -1,15 +1,12 @@
-/* AsyncHelper 注释
- * -- AsyncHelper来自于AsyncEx,为了引用方便直接拷贝了代码。Modbus.Net的作者不保留对AsyncHeloper类的版权。
- * -- AsyncHelper copied from AsyncEx. The author of "Modbus.Net" donnot obtain the copyright of AsyncHelper(Only).
- */
-
-using System;
-using System.Collections.Generic;
+using System;
using System.Threading;
using System.Threading.Tasks;
namespace Modbus.Net
{
+ ///
+ /// AsyncHelper Class
+ ///
public static class AsyncHelper
{
private static readonly TaskFactory _myTaskFactory = new
@@ -64,106 +61,4 @@ namespace Modbus.Net
return task.ContinueWith(t => t.GetAwaiter().GetResult(), token);
}
}
-
- ///
- /// AsyncLock locks across one or several await calls.
- ///
- public class AsyncLock
- {
- private readonly Task _releaser;
- private readonly AsyncSemaphore _semaphore;
-
- public AsyncLock()
- {
- _semaphore = new AsyncSemaphore(1);
- _releaser = Task.FromResult(new Releaser(this));
- }
-
- ///
- /// Lock the async method. Call like: using (await asynclock.LockAsync())
- ///
- ///
- public Task LockAsync()
- {
- var wait = _semaphore.WaitAsync();
- return wait.IsCompleted
- ? _releaser
- : wait.ContinueWith((_, state) => new Releaser((AsyncLock) state),
- this, CancellationToken.None,
- TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
- }
-
-
- public struct Releaser : IDisposable
- {
- private readonly AsyncLock _toRelease;
-
- internal Releaser(AsyncLock toRelease)
- {
- _toRelease = toRelease;
- }
-
- public void Dispose()
- {
- if (_toRelease != null)
- {
- _toRelease._semaphore.Release();
- }
- }
- }
- }
-
- ///
- /// AsyncSemaphore semaphore the multi run tasks.
- ///
- public class AsyncSemaphore
- {
- private static readonly Task _completed = Task.FromResult(true);
- private readonly Queue> _waiters = new Queue>();
- private int _currentCount;
-
- public AsyncSemaphore(int initialCount)
- {
- if (initialCount < 0)
- {
- throw new ArgumentOutOfRangeException("initialCount");
- }
- _currentCount = initialCount;
- }
-
- public Task WaitAsync()
- {
- lock (_waiters)
- {
- if (_currentCount > 0)
- {
- _currentCount--;
- return _completed;
- }
- var waiter = new TaskCompletionSource();
- _waiters.Enqueue(waiter);
- return waiter.Task;
- }
- }
-
- public void Release()
- {
- TaskCompletionSource toRelease = null;
- lock (_waiters)
- {
- if (_waiters.Count > 0)
- {
- toRelease = _waiters.Dequeue();
- }
- else
- {
- _currentCount++;
- }
- }
- if (toRelease != null)
- {
- toRelease.SetResult(true);
- }
- }
- }
}
\ No newline at end of file