ClickHouse/dbms/src/Common/SimpleIncrement.h
2017-05-10 02:50:37 -04:00

25 lines
342 B
C++

#pragma once
#include <common/Types.h>
#include <atomic>
/** Is used for numbering of files.
*/
struct SimpleIncrement
{
std::atomic<UInt64> value;
SimpleIncrement(UInt64 start = 0) : value(start) {}
void set(UInt64 new_value)
{
value = new_value;
}
UInt64 get()
{
return ++value;
}
};