aboutsummaryrefslogtreecommitdiff
path: root/src/init.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2021-01-25 22:45:54 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2021-03-04 18:24:00 +0100
commite017a913d0d78ef0766cf73586fe7a38488e1a26 (patch)
treef5d47c98db9c0c32c59a0f08aaeb6aaed75dbe70 /src/init.h
parentc3e6fdee6d39d3f52dec421b48a0ac8bad5006f7 (diff)
downloadbitcoin-e017a913d0d78ef0766cf73586fe7a38488e1a26.tar.xz
bitcoind: Add -daemonwait option to wait for initialization
This adds a `-daemonwait` flag that does the same as `-daemon` except it, from a user perspective, backgrounds the process only after initialization is complete. This can be useful when the process launching bitcoind wants to guarantee that either the RPC server is running, or that initialization failed, before continuing. The exit code indicates the initialization result. This replaces the use of the libc function `daemon()` by a custom implementation which is inspired by the glibc implementation, but also creates a pipe from the child to the parent process for communication. An additional advantage of having our own `daemon()` implementation is that no MACOS-specific pragmas are needed anymore to silence a deprecation warning.
Diffstat (limited to 'src/init.h')
-rw-r--r--src/init.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/init.h b/src/init.h
index c04d966d06..34bca09dd1 100644
--- a/src/init.h
+++ b/src/init.h
@@ -9,6 +9,11 @@
#include <memory>
#include <string>
+//! Default value for -daemon option
+static constexpr bool DEFAULT_DAEMON = false;
+//! Default value for -daemonwait option
+static constexpr bool DEFAULT_DAEMONWAIT = false;
+
class ArgsManager;
struct NodeContext;
namespace interfaces {