mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
util: Add SignalInterrupt class and use in shutdown.cpp
This change helps generalize shutdown code so an interrupt can be provided to libbitcoinkernel callers. This may also be useful to eventually de-globalize all of the shutdown code. Co-authored-by: Russell Yanofsky <russ@yanofsky.org> Co-authored-by: TheCharlatan <seb.kung@gmail.com>
This commit is contained in:
@@ -14,9 +14,12 @@
|
||||
|
||||
|
||||
namespace kernel {
|
||||
Context* g_context;
|
||||
|
||||
Context::Context()
|
||||
{
|
||||
assert(!g_context);
|
||||
g_context = this;
|
||||
std::string sha256_algo = SHA256AutoDetect();
|
||||
LogPrintf("Using the '%s' SHA256 implementation\n", sha256_algo);
|
||||
RandomInit();
|
||||
@@ -26,6 +29,8 @@ Context::Context()
|
||||
Context::~Context()
|
||||
{
|
||||
ECC_Stop();
|
||||
assert(g_context);
|
||||
g_context = nullptr;
|
||||
}
|
||||
|
||||
} // namespace kernel
|
||||
|
||||
Reference in New Issue
Block a user