mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-06 23:43:07 +00:00
25 lines
444 B
C#
25 lines
444 B
C#
namespace Utils
|
|
{
|
|
public class NumberSource
|
|
{
|
|
private readonly object @lock = new object();
|
|
private int number;
|
|
|
|
public NumberSource(int start)
|
|
{
|
|
number = start;
|
|
}
|
|
|
|
public int GetNextNumber()
|
|
{
|
|
var n = -1;
|
|
lock (@lock)
|
|
{
|
|
n = number;
|
|
number++;
|
|
}
|
|
return n;
|
|
}
|
|
}
|
|
}
|