Files
faumaray 45eb2cab42 Update
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-12 02:57:35 +03:00

30 lines
717 B
C++

#pragma once
#include <PluginTypes.hpp>
#include <condition_variable>
#include <cstddef>
#include <mutex>
#include <vector>
namespace Echoion::Standalone
{
// Owns plugin-event callbacks across a dynamically loaded Core boundary.
// quiesce() is a lifetime barrier: after it returns no callback object, nor
// callback invocation, can still reference code from the old Core image.
class EventCallbackGate final
{
public:
void add(Api::EventCallback callback);
void quiesce();
void dispatch(const Api::PluginEvent& event);
private:
std::mutex mutex_;
std::condition_variable cv_;
std::vector<Api::EventCallback> callbacks_;
std::size_t activeDispatches_{0};
bool accepting_{true};
};
}