summaryrefslogtreecommitdiffstats
path: root/storageframework/src/vespa/storageframework/generic/thread/threadpool.cpp
blob: d72b0c545444682e79bb201d33cfe9671603cdcd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "threadpool.h"

namespace storage {
namespace framework {

ThreadProperties::ThreadProperties(uint64_t waitTimeMs,
                                   uint64_t maxProcessTimeMs,
                                   int ticksBeforeWait)
{
    _waitTimeMs.store(waitTimeMs);
    _maxProcessTimeMs.store(maxProcessTimeMs);
    _ticksBeforeWait.store(ticksBeforeWait);
}

uint64_t ThreadProperties::getMaxProcessTime() const {
    return _maxProcessTimeMs.load(std::memory_order_relaxed);
}

uint64_t ThreadProperties::getWaitTime() const {
    return _waitTimeMs.load(std::memory_order_relaxed);
}

int ThreadProperties::getTicksBeforeWait() const {
    return _ticksBeforeWait.load(std::memory_order_relaxed);
}

void ThreadProperties::setMaxProcessTime(uint64_t maxProcessingTimeMs) {
    _maxProcessTimeMs.store(maxProcessingTimeMs);
}

void ThreadProperties::setWaitTime(uint64_t waitTimeMs) {
    _waitTimeMs.store(waitTimeMs);
}

void ThreadProperties::setTicksBeforeWait(int ticksBeforeWait) {
    _ticksBeforeWait.store(ticksBeforeWait);
}

} // framework
} // storage