blob: d6053a2f1282352a2d39addccff6a33b44f64c85 (
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
|
// 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>
#include <vespa/fastos/thread.h>
namespace storage::framework::defaultimplementation {
class ThreadImpl;
struct ThreadPoolImpl : public ThreadPool
{
FastOS_ThreadPool _backendThreadPool;
std::vector<ThreadImpl*> _threads;
mutable std::mutex _threadVectorLock;
Clock & _clock;
bool _stopping;
public:
ThreadPoolImpl(Clock&);
~ThreadPoolImpl() override;
Thread::UP 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 registerThread(ThreadImpl&);
void unregisterThread(ThreadImpl&);
FastOS_ThreadPool& getThreadPool() { return _backendThreadPool; }
Clock& getClock() { return _clock; }
};
}
|