aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Common/MemoryTrackerBlockerInThread.cpp
blob: 3d763576c7b5a1e6abc0b17fd6fd94b8685d05e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <Common/MemoryTrackerBlockerInThread.h>

// MemoryTrackerBlockerInThread
thread_local uint64_t MemoryTrackerBlockerInThread::counter = 0;
thread_local VariableContext MemoryTrackerBlockerInThread::level = VariableContext::Global;

MemoryTrackerBlockerInThread::MemoryTrackerBlockerInThread(VariableContext level_)
    : previous_level(level)
{
    ++counter;
    level = level_;
}

MemoryTrackerBlockerInThread::MemoryTrackerBlockerInThread() : MemoryTrackerBlockerInThread(VariableContext::User)
{
}

MemoryTrackerBlockerInThread::~MemoryTrackerBlockerInThread()
{
    --counter;
    level = previous_level;
}