1 parent
4a92d09e63
commit
45eb2cab42
12 files changed
+991
-162
No files matched your search
@@ -0,0 +1,29 @@
|
||||
#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};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user