blob: 4319b4a0efefb475fa8d20bf474b209a6f183a72 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/storageframework/generic/thread/threadpool.h>
namespace storage::framework {
struct Clock;
}
namespace storage::framework::defaultimplementation {
class ThreadImpl;
struct ThreadPoolImpl final : public ThreadPool
{
std::vector<ThreadImpl*> _threads;
mutable std::mutex _threadVectorLock;
Clock & _clock;
bool _stopping;
public:
ThreadPoolImpl(Clock&);
~ThreadPoolImpl() override;
std::unique_ptr<Thread> startThread(Runnable&, vespalib::stringref id, vespalib::duration waitTime,
vespalib::duration maxProcessTime, int ticksBeforeWait,
std::optional<vespalib::CpuUsage::Category> cpu_category) override;
void visitThreads(ThreadVisitor&) const override;
void unregisterThread(ThreadImpl&);
Clock& getClock() { return _clock; }
};
}
|