1
This commit is contained in:
@@ -9,6 +9,7 @@ namespace BITKit
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public interface IDoubleBuffer<T>
|
||||
{
|
||||
bool CanRelease { get; }
|
||||
T Current { get; }
|
||||
void Release(T newValue);
|
||||
event Action<T> OnRelease;
|
||||
@@ -20,6 +21,8 @@ namespace BITKit
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class DoubleBuffer<T> : IDoubleBuffer<T>
|
||||
{
|
||||
public bool CanRelease => _release.Allow;
|
||||
|
||||
public T Current
|
||||
{
|
||||
get;
|
||||
@@ -34,6 +37,11 @@ namespace BITKit
|
||||
_release.SetValueThenAllow(newValue);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_release.Clear();
|
||||
}
|
||||
|
||||
public event Action<T> OnRelease;
|
||||
private readonly Optional<T> _release=new();
|
||||
|
||||
|
Reference in New Issue
Block a user