diff options
| author | Martin Ridgers <[email protected]> | 2021-10-28 10:03:39 +0200 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-10-28 10:03:39 +0200 |
| commit | d51e683e69c2afec326ae943de7a919fed9fe85f (patch) | |
| tree | 6f3a5c9f1dccb7563ae97dd46349ca563e439899 /zenutil | |
| parent | Merged main (diff) | |
| parent | Lockfile implementation (#24) (diff) | |
| download | zen-d51e683e69c2afec326ae943de7a919fed9fe85f.tar.xz zen-d51e683e69c2afec326ae943de7a919fed9fe85f.zip | |
Merged main
Diffstat (limited to 'zenutil')
| -rw-r--r-- | zenutil/include/zenutil/zenserverprocess.h | 16 | ||||
| -rw-r--r-- | zenutil/zenserverprocess.cpp | 6 |
2 files changed, 17 insertions, 5 deletions
diff --git a/zenutil/include/zenutil/zenserverprocess.h b/zenutil/include/zenutil/zenserverprocess.h index 09728aa1a..8a4f9604d 100644 --- a/zenutil/include/zenutil/zenserverprocess.h +++ b/zenutil/include/zenutil/zenserverprocess.h @@ -94,17 +94,22 @@ public: struct ZenServerEntry { + // NOTE: any changes to this should consider backwards compatibility + // which means you should not rearrange members only potentially + // add something to the end or use a different mechanism for + // additional state. For example, you can use the session ID + // to introduce additional named objects std::atomic<uint32_t> Pid; std::atomic<uint16_t> ListenPort; std::atomic<uint16_t> Flags; uint8_t SessionId[12]; - std::atomic<uint32_t> SponsorPids[32]; + std::atomic<uint32_t> SponsorPids[8]; uint8_t Padding[12]; - uint8_t Padding2[96]; enum class FlagsEnum : uint16_t { - kShutdownPlease = 1 << 0 + kShutdownPlease = 1 << 0, + kIsReady = 1 << 1, }; FRIEND_ENUM_CLASS_FLAGS(FlagsEnum); @@ -112,10 +117,11 @@ public: Oid GetSessionId() const { return Oid::FromMemory(SessionId); } void Reset(); void SignalShutdownRequest(); + void SignalReady(); bool AddSponsorProcess(uint32_t Pid); }; - static_assert(sizeof(ZenServerEntry) == 256); + static_assert(sizeof(ZenServerEntry) == 64); void Initialize(); [[nodiscard]] bool InitializeReadOnly(); @@ -128,7 +134,7 @@ public: private: void* m_hMapFile = nullptr; ZenServerEntry* m_Data = nullptr; - int m_MaxEntryCount = 131072 / sizeof(ZenServerEntry); + int m_MaxEntryCount = 65536 / sizeof(ZenServerEntry); ZenServerEntry* m_OurEntry = nullptr; bool m_IsReadOnly = true; }; diff --git a/zenutil/zenserverprocess.cpp b/zenutil/zenserverprocess.cpp index ab3454a91..fd0490c72 100644 --- a/zenutil/zenserverprocess.cpp +++ b/zenutil/zenserverprocess.cpp @@ -271,6 +271,12 @@ ZenServerState::ZenServerEntry::SignalShutdownRequest() Flags |= uint16_t(FlagsEnum::kShutdownPlease); } +void +ZenServerState::ZenServerEntry::SignalReady() +{ + Flags |= uint16_t(FlagsEnum::kIsReady); +} + bool ZenServerState::ZenServerEntry::AddSponsorProcess(uint32_t PidToAdd) { |