载入中...
搜索中...
未找到
ProcgenLive.cpp
浏览该文件的文档.
2
3#include "procgen/Procgen.h"
4
5#include <atomic>
6
7namespace eve::procgen {
8namespace {
9
10std::atomic<Procgen*> g_liveProcgen{nullptr};
11
12} // namespace
13
14Procgen* liveProcgen() noexcept { return g_liveProcgen.load(std::memory_order_acquire); }
15
16void publishLiveProcgen(Procgen* instance) noexcept {
17 g_liveProcgen.store(instance, std::memory_order_release);
18}
19
20void clearLiveProcgen(Procgen* instance) noexcept {
21 Procgen* expected = instance;
22 (void)g_liveProcgen.compare_exchange_strong(expected, nullptr, std::memory_order_acq_rel,
23 std::memory_order_acquire);
24}
25
26} // namespace eve::procgen
Procedural generation module. Phase A: runtime maps (semantic Grid2D → TileLayer)....
Definition Procgen.h:159
void clearLiveProcgen(Procgen *instance) noexcept
Clears the live Procgen owner when it matches instance (destructor).
Procgen * liveProcgen() noexcept
Returns the currently live Procgen module instance, or nullptr.
void publishLiveProcgen(Procgen *instance) noexcept
Publishes instance as the live Procgen owner (constructor path).