17#ifndef CYBER_DATA_DATA_NOTIFIER_H_
18#define CYBER_DATA_DATA_NOTIFIER_H_
48 const std::shared_ptr<Notifier>& notifier);
50 bool Notify(
const uint64_t channel_id);
53 std::mutex notifies_map_mutex_;
59inline DataNotifier::DataNotifier() {}
62 uint64_t channel_id,
const std::shared_ptr<Notifier>& notifier) {
63 std::lock_guard<std::mutex> lock(notifies_map_mutex_);
65 if (notifies_map_.
Get(channel_id, ¬ifies)) {
66 notifies->emplace_back(notifier);
69 notifies_map_.
Set(channel_id, new_notify);
75 if (notifies_map_.
Get(channel_id, ¬ifies)) {
76 for (
auto& notifier : *notifies) {
77 if (notifier && notifier->callback) {
Cyber has builtin time type Time.
A implementation of lock-free fixed size hash map
bool Get(K key, V **value)
bool Notify(const uint64_t channel_id)
void AddNotifier(uint64_t channel_id, const std::shared_ptr< Notifier > ¬ifier)
std::vector< std::shared_ptr< Notifier > > NotifyVector
#define DECLARE_SINGLETON(classname)
std::function< void()> callback