Make further properties multi-client and thread-safe

Move MovingPrimary, MovingSecondary, EarliestNonSlewingTime to
SharedResources, make all new properties thread-safe (atomic)
operations.
This commit is contained in:
Sebastian Godelet
2021-06-22 17:21:21 +10:00
parent af750549fe
commit 6fc476b031
16 changed files with 435 additions and 44 deletions
+17
View File
@@ -0,0 +1,17 @@
using System.Threading;
namespace ASCOM.Meade.net
{
public class ThreadSafeBool
{
private object _value;
public ThreadSafeBool(in bool value) => _value = value;
public void Set(in bool value) => Interlocked.Exchange(ref _value, value);
public static implicit operator ThreadSafeBool(in bool value) => new ThreadSafeBool(value);
public static implicit operator bool(ThreadSafeBool @this) => (bool)@this._value;
}
}