aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Common/SimpleIncrement.h
blob: f88660f64f1c279c78d0acf3c42bcbacc178f498 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include <base/types.h>
#include <atomic>


/** Is used for numbering of files.
  */
struct SimpleIncrement
{
    std::atomic<UInt64> value{0};

    void set(UInt64 new_value)
    {
        value = new_value;
    }

    UInt64 get()
    {
        return ++value;
    }
};