mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
3c5dcb036a
084e17cebd424b8e8ced674bc810eef4e6ee5d3b Remove unused includes (practicalswift) Pull request description: As requested by MarcoFalke in https://github.com/bitcoin/bitcoin/pull/16273#issuecomment-521332089: This PR removes unused includes. Please note that in contrast to #16273 I'm limiting the scope to the trivial cases of pure removals (i.e. no includes added) to make reviewing easier. I'm seeking "Concept ACK":s for this obviously non-urgent minor cleanup. Rationale: * Avoids unnecessary re-compiles in case of header changes. * Makes reasoning about code dependencies easier. * Reduces compile-time memory usage. * Reduces compilation time. * Warm fuzzy feeling of being lean :-) ACKs for top commit: ryanofsky: Code review ACK 084e17cebd424b8e8ced674bc810eef4e6ee5d3b. PR only removes include lines and it still compiles. In the worst case someone might have to explicitly add an include later for something now included implicitly. But maybe some effort was taken to avoid this, and it wouldn't be a tragedy anyway. Tree-SHA512: 89de56edc6ceea4696e9579bccff10c80080821685b9fb4e8c5ef593b6e43cf662f358788701bb09f84867693f66b2e4db035b92b522a0a775f50b7ecffd6a6d
37 lines
942 B
C++
37 lines
942 B
C++
// Copyright (c) 2016 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_THREADINTERRUPT_H
|
|
#define BITCOIN_THREADINTERRUPT_H
|
|
|
|
#include <sync.h>
|
|
|
|
#include <atomic>
|
|
#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.
|
|
*/
|
|
class CThreadInterrupt
|
|
{
|
|
public:
|
|
CThreadInterrupt();
|
|
explicit operator bool() const;
|
|
void operator()();
|
|
void reset();
|
|
bool sleep_for(std::chrono::milliseconds rel_time);
|
|
bool sleep_for(std::chrono::seconds rel_time);
|
|
bool sleep_for(std::chrono::minutes rel_time);
|
|
|
|
private:
|
|
std::condition_variable cond;
|
|
Mutex mut;
|
|
std::atomic<bool> flag;
|
|
};
|
|
|
|
#endif //BITCOIN_THREADINTERRUPT_H
|