blob: 65235e6a2fe672f237cfa7a17918340f5f3042f0 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/util/runnable.h>
#include <vespa/vespalib/util/threadexecutor.h>
namespace searchcorespi::index {
/**
* Interface for a single thread used for write tasks.
*/
struct IThreadService : public vespalib::ThreadExecutor
{
IThreadService(const IThreadService &) = delete;
IThreadService & operator = (const IThreadService &) = delete;
IThreadService() = default;
virtual ~IThreadService() {}
/**
* Run the given runnable in the underlying thread and wait until its done.
*/
virtual void run(vespalib::Runnable &runnable) = 0;
/**
* Returns whether the current thread is the underlying thread.
*/
virtual bool isCurrentThread() const = 0;
};
struct ISyncableThreadService : public IThreadService, vespalib::Syncable {
};
}
|