aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/util/invokeservice.h
blob: cd871bbfe4fb3de4e658d1ef6f3805025a9d405a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "idestructorcallback.h"
#include "time.h"
#include <functional>

namespace vespalib {

/**
 * Interface to register for receiving regular invoke calls.
 * The registration will last as long as the returned object is kept alive.
 **/
class InvokeService {
public:
    using InvokeFunc = std::function<void()>;
    virtual ~InvokeService() = default;
    virtual std::unique_ptr<IDestructorCallback> registerInvoke(InvokeFunc func) = 0;
};

}