4#ifndef _Stroika_Foundation_Execution_CallbackRegistry_h_
5#define _Stroika_Foundation_Execution_CallbackRegistry_h_ 1
7#include "Stroika/Foundation/StroikaPreComp.h"
11#include <condition_variable>
18#include "Stroika/Foundation/Common/Common.h"
82 template <
typename FUNCTION_SIGNATURE>
85 template <
typename... ARGS>
88 using Callback = function<void (ARGS...)>;
117 nonvirtual ID Add (
const Callback& callback);
124 nonvirtual
void Remove (ID
id)
noexcept;
143 nonvirtual
void RemoveAll () noexcept;
150 nonvirtual
void Call (ARGS... args);
153 struct Entry_ : Memory::UseBlockAllocationIfAppropriate<Entry_> {
154 Entry_ (ID
id,
const Callback& callback);
157 bool fRemoved{
false};
158 vector<thread::id> fRunningOn;
162 mutable mutex fMutex_;
163 condition_variable fCallEnded_;
164 vector<shared_ptr<Entry_>> fEntries_;
174#include "CallbackRegistry.inl"
An opaque ID - each New () one never given before, in this process - of a type of its own for each TA...
The callbacks an object calls when something happens - each added, and removed by the ID Add gave it ...