ClickHouse/src/Common/SimpleIncrement.h

23 lines
286 B
C++
Raw Normal View History

#pragma once
2021-10-02 07:13:14 +00:00
#include <base/types.h>
#include <atomic>
/** Is used for numbering of files.
*/
struct SimpleIncrement
{
2020-12-21 07:48:15 +00:00
std::atomic<UInt64> value{0};
void set(UInt64 new_value)
{
value = new_value;
}
UInt64 get()
{
return ++value;
}
};