aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/util/fake_doom.h
blob: 496129d8f0f3dfd9ff28dcc6a240c7765aad8621 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "doom.h"

namespace vespalib {

/*
 * Class containing a fake doom controlled by the time_to_doom
 * constructor argument.
 */
class FakeDoom {
    std::atomic<steady_time> _time;
    Clock                    _clock;
    Doom                     _doom;
public:
    FakeDoom() : FakeDoom(1s) { }
    FakeDoom(steady_time::duration time_to_doom);
    ~FakeDoom();
    const Doom& get_doom() const noexcept { return _doom; }
};

}