aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/util/invokeservice.h
blob: 22bee0d45264aa1fba5379d9537ab075d7ec039b (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 Yahoo. 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;
};

}