Got at least one data fetching method working; turns out, we can't use a patched LogicStack to get the data

This commit is contained in:
2026-01-14 22:11:11 +01:00
parent 40a8431464
commit 3f7122d30a
350 changed files with 41444 additions and 119 deletions

View File

@@ -0,0 +1,43 @@
using System;
using System.Threading;
namespace Swan.Threading
{
/// <summary>
/// Defines an atomic generic Enum.
/// </summary>
/// <typeparam name="T">The type of enum.</typeparam>
public sealed class AtomicEnum<T>
where T : struct, IConvertible
{
private long _backingValue;
/// <summary>
/// Initializes a new instance of the <see cref="AtomicEnum{T}"/> class.
/// </summary>
/// <param name="initialValue">The initial value.</param>
/// <exception cref="ArgumentException">T must be an enumerated type.</exception>
public AtomicEnum(T initialValue)
{
if (!Enum.IsDefined(typeof(T), initialValue))
throw new ArgumentException("T must be an enumerated type");
Value = initialValue;
}
/// <summary>
/// Gets or sets the value.
/// </summary>
public T Value
{
get => (T)Enum.ToObject(typeof(T), BackingValue);
set => BackingValue = Convert.ToInt64(value);
}
private long BackingValue
{
get => Interlocked.Read(ref _backingValue);
set => Interlocked.Exchange(ref _backingValue, value);
}
}
}