aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenutil')
-rw-r--r--src/zenutil/include/zenutil/zenserverprocess.h2
-rw-r--r--src/zenutil/zenserverprocess.cpp8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/zenutil/include/zenutil/zenserverprocess.h b/src/zenutil/include/zenutil/zenserverprocess.h
index 1bd00acb7..f7204fb43 100644
--- a/src/zenutil/include/zenutil/zenserverprocess.h
+++ b/src/zenutil/include/zenutil/zenserverprocess.h
@@ -168,7 +168,7 @@ public:
bool IsShutdownRequested() const;
void SignalReady();
bool IsReady() const;
- bool AddSponsorProcess(uint32_t Pid);
+ bool AddSponsorProcess(uint32_t Pid, uint64_t Timeout = 0);
};
static_assert(sizeof(ZenServerEntry) == 64);
diff --git a/src/zenutil/zenserverprocess.cpp b/src/zenutil/zenserverprocess.cpp
index f5bc088a5..34eec9790 100644
--- a/src/zenutil/zenserverprocess.cpp
+++ b/src/zenutil/zenserverprocess.cpp
@@ -403,7 +403,7 @@ ZenServerState::ZenServerEntry::IsReady() const
}
bool
-ZenServerState::ZenServerEntry::AddSponsorProcess(uint32_t PidToAdd)
+ZenServerState::ZenServerEntry::AddSponsorProcess(uint32_t PidToAdd, uint64_t Timeout)
{
uint32_t ServerPid = Pid.load();
auto WaitForPickup = [&](uint32_t AddedSlotIndex) {
@@ -427,13 +427,13 @@ ZenServerState::ZenServerEntry::AddSponsorProcess(uint32_t PidToAdd)
{
if (SponsorPids[SponsorIndex].load(std::memory_order_relaxed) == PidToAdd)
{
- return WaitForPickup(SponsorIndex);
+ return Timeout == 0 ? true : WaitForPickup(SponsorIndex);
}
uint32_t Expected = 0;
if (SponsorPids[SponsorIndex].compare_exchange_strong(Expected, PidToAdd))
{
// Success!
- return WaitForPickup(SponsorIndex);
+ return Timeout == 0 ? true : WaitForPickup(SponsorIndex);
}
}
@@ -865,6 +865,8 @@ ZenServerInstance::OnServerReady()
m_BasePort = Entry->EffectiveListenPort;
CreateShutdownEvent(m_BasePort);
+
+ ZEN_DEBUG("Server '{}' is ready on port {}", m_Name, m_BasePort);
}
std::string