blob: c9b5a37765ac7c8da8a27689f94c9069997172a3 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "iconfigholder.h"
#include <mutex>
#include <condition_variable>
namespace config {
/**
* A config holder contains the latest config object of a subscription.
*/
class ConfigHolder : public IConfigHolder
{
public:
ConfigHolder();
~ConfigHolder() override;
std::unique_ptr<ConfigUpdate> provide() override;
void handle(std::unique_ptr<ConfigUpdate> update) override;
bool wait(milliseconds timeoutInMillis) override;
bool poll() override;
void interrupt() override;
public:
std::mutex _lock;
std::condition_variable _cond;
std::unique_ptr<ConfigUpdate> _current;
};
} // namespace config
|