blob: 43502ec7ff0551cf2171924023b5303b6c6b0cae (
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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "executor.h"
#include "syncable.h"
#include "executor_stats.h"
namespace vespalib {
class ThreadExecutor : public Executor
{
public:
/**
* Get number of threads in the executor pool.
* @return number of threads in the pool
*/
virtual size_t getNumThreads() const = 0;
/**
* Observe and reset stats for this object.
* @return stats
**/
virtual ExecutorStats getStats() = 0;
/**
* Sets a new upper limit for accepted number of tasks.
*/
virtual void setTaskLimit(uint32_t taskLimit) = 0;
/**
* Gets the limit for accepted number of tasks.
*/
virtual uint32_t getTaskLimit() const = 0;
};
/**
* Can both execute and sync
**/
class SyncableThreadExecutor : public ThreadExecutor, public Syncable
{
public:
virtual SyncableThreadExecutor & shutdown() = 0;
};
} // namespace vespalib
|