mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-06 11:13:02 +02: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:
@@ -12,11 +12,17 @@
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
|
||||
/*
|
||||
A helper class for interruptible sleeps. Calling operator() will interrupt
|
||||
any current sleep, and after that point operator bool() will return true
|
||||
until reset.
|
||||
*/
|
||||
/**
|
||||
* A helper class for interruptible sleeps. Calling operator() will interrupt
|
||||
* any current sleep, and after that point operator bool() will return true
|
||||
* until reset.
|
||||
*
|
||||
* This class should not be used in a signal handler. It uses thread
|
||||
* synchronization primitives that are not safe to use with signals. If sending
|
||||
* an interrupt from a signal handler is necessary, the \ref SignalInterrupt
|
||||
* class can be used instead.
|
||||
*/
|
||||
|
||||
class CThreadInterrupt
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user