载入中...
搜索中...
未找到
CapabilityOwned.cpp
浏览该文件的文档.
2
3namespace eve::cap::detail {
4namespace {
5struct OwnedTables {
6 std::mutex mutex;
7 std::mutex publicationMutex;
8 std::unordered_map<std::string, std::unique_ptr<ProviderRegistry<void>>> registries;
9};
10OwnedTables& tables() {
11 static OwnedTables state;
12 return state;
13}
14} // namespace
15
16std::mutex& ownedPublicationMutex() { return tables().publicationMutex; }
17
18ProviderRegistry<void>& ownedRegistry(const char* capabilityName) {
19 std::scoped_lock lock(tables().mutex);
20 auto& registry = tables().registries[capabilityName ? capabilityName : ""];
21 if (!registry) registry = std::make_unique<ProviderRegistry<void>>();
22 return *registry;
23}
24
26 decltype(OwnedTables::registries) retired;
27 {
28 std::scoped_lock lock(tables().mutex);
29 retired.swap(tables().registries);
30 }
31 // Provider destructors may reenter the capability API; no registry lock is held.
32}
33} // namespace eve::cap::detail
std::mutex mutex
std::unordered_map< std::string, std::unique_ptr< ProviderRegistry< void > > > registries
std::mutex publicationMutex
Optional owning capability registration (shared_ptr + generation + lease).
std::vector< std::unique_ptr< ScriptClimbingEventSink > > retired
const eve::script::BindingContractRegistry & registry
Instance-owned publication mechanism shared by capability and domain registries. @ownership The regis...
ProviderRegistry< void > & ownedRegistry(const char *capabilityName)
void clearOwnedRaw()
Clear publications for isolated tests after borrowed dispatch has stopped.
std::mutex & ownedPublicationMutex()
Process-owned type-erased store; one canonical instance across link groups.