MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / waitForShutdown

Function waitForShutdown

src/jrd/jrd.cpp:8960–8993  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8958
8959
8960static void waitForShutdown(Semaphore& shutdown_semaphore)
8961{
8962 const int pid = getpid();
8963 unsigned int timeout = 10; // initial value, 10 sec
8964 bool done = false;
8965
8966 for (int i = 0; i < 5; i++)
8967 {
8968 gds__log("PID %d: engine shutdown is in progress with %s database(s) attached",
8969 pid, databases == NULL ? "no" : "some");
8970
8971 timeout *= 2;
8972 if (shutdown_semaphore.tryEnter(timeout))
8973 {
8974 done = true;
8975 break;
8976 }
8977 }
8978
8979 if (!done)
8980 {
8981 if (databases == NULL)
8982 {
8983 gds__log("PID %d: wait for engine shutdown failed, terminating", pid);
8984 if (Config::getBugcheckAbort())
8985 abort();
8986
8987 // return immediately
8988 _exit(5);
8989 }
8990
8991 shutdown_semaphore.enter();
8992 }
8993}
8994
8995
8996static THREAD_ENTRY_DECLARE shutdown_thread(THREAD_ENTRY_PARAM arg)

Callers 1

shutdownMethod · 0.85

Calls 2

tryEnterMethod · 0.45
enterMethod · 0.45

Tested by

no test coverage detected