blob: b45ada1c58c8f66e59488f4e5564dc8f833c2b5d (
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 "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, vespalib::Executor::Task::UP task)
{
assert(id.getId() < getNumExecutors());
task->run();
_accepted++;
}
void
ForegroundTaskExecutor::sync()
{
}
void ForegroundTaskExecutor::setTaskLimit(uint32_t) {
}
vespalib::ExecutorStats ForegroundTaskExecutor::getStats() {
return vespalib::ExecutorStats(vespalib::ExecutorStats::QueueSizeT(0) , _accepted.load(std::memory_order_relaxed), 0);
}
} // namespace search
|