blob: b788a3eed780f6112e8ef4ffb7f8e47ab7778def (
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
|
// 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>
class FastOS_ThreadPool;
namespace storage::framework {
struct Clock;
}
namespace storage::framework::defaultimplementation {
class ThreadImpl;
struct ThreadPoolImpl final : public ThreadPool
{
std::unique_ptr<FastOS_ThreadPool> _backendThreadPool;
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&);
FastOS_ThreadPool& getThreadPool() { return *_backendThreadPool; }
Clock& getClock() { return _clock; }
};
}
|