forked from bit/DotRecastNetSim
29 lines
617 B
C#
29 lines
617 B
C#
using System.Threading;
|
|
|
|
namespace DotRecast.Core
|
|
{
|
|
public class AtomicFloat
|
|
{
|
|
private volatile float _location;
|
|
|
|
public AtomicFloat(float location)
|
|
{
|
|
_location = location;
|
|
}
|
|
|
|
public float Get()
|
|
{
|
|
return _location;
|
|
}
|
|
|
|
public float Exchange(float exchange)
|
|
{
|
|
return Interlocked.Exchange(ref _location, exchange);
|
|
}
|
|
|
|
public float CompareExchange(float value, float comparand)
|
|
{
|
|
return Interlocked.CompareExchange(ref _location, value, comparand);
|
|
}
|
|
}
|
|
} |