winmr-api/Utils/ConcurrentObject.cs
2025-07-04 00:04:51 +03:00

21 lines
484 B
C#

/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2024-2025 Gregory Lirent */
namespace WebmrAPI.Utils
{
public class ConcurrentObject
{
internal readonly object _lock = new object();
public void LockedSet<T>(ref T dst, T value)
{
lock (_lock) dst = value;
}
public T LockedGet<T>(ref T src)
{
lock (_lock) return src;
}
}
}