blob: 703256c55213332d4b59678a09be0453b01fcf1d (
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
43
44
45
46
47
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "foregroundtaskexecutor.h"
#include <cassert>
namespace vespalib {
ForegroundTaskExecutor::ForegroundTaskExecutor()
: ForegroundTaskExecutor(1)
{
}
ForegroundTaskExecutor::ForegroundTaskExecutor(uint32_t threads)
: ISequencedTaskExecutor(threads),
_accepted(0)
{
}
ForegroundTaskExecutor::~ForegroundTaskExecutor() = default;
void
ForegroundTaskExecutor::executeTask(ExecutorId id, Executor::Task::UP task)
{
assert(id.getId() < getNumExecutors());
task->run();
_accepted++;
}
void
ForegroundTaskExecutor::sync()
{
}
void ForegroundTaskExecutor::setTaskLimit(uint32_t) {
}
ExecutorStats ForegroundTaskExecutor::getStats() {
return ExecutorStats(ExecutorStats::QueueSizeT(0) , _accepted.load(std::memory_order_relaxed), 0, 0);
}
ISequencedTaskExecutor::ExecutorId
ForegroundTaskExecutor::getExecutorId(uint64_t componentId) const {
return ExecutorId(componentId%getNumExecutors());
}
}
|