Name currently-unnamed threads that we can rename
After this, the only threads that aren't named are the LevelDB background threads.
This commit is contained in:
parent
6aa7c187d1
commit
1f1810c37d
|
@ -982,6 +982,7 @@ dependencies = [
|
||||||
"orchard",
|
"orchard",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"rand_core 0.6.3",
|
"rand_core 0.6.3",
|
||||||
|
"rayon",
|
||||||
"secp256k1",
|
"secp256k1",
|
||||||
"secrecy",
|
"secrecy",
|
||||||
"subtle",
|
"subtle",
|
||||||
|
|
|
@ -57,6 +57,9 @@ zcash_proofs = "0.6"
|
||||||
ed25519-zebra = "3"
|
ed25519-zebra = "3"
|
||||||
zeroize = "1.4.2"
|
zeroize = "1.4.2"
|
||||||
|
|
||||||
|
# Rust threading
|
||||||
|
rayon = "1.5"
|
||||||
|
|
||||||
# Metrics
|
# Metrics
|
||||||
ipnet = "2"
|
ipnet = "2"
|
||||||
metrics = "0.17"
|
metrics = "0.17"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// file COPYING or https://www.opensource.org/licenses/mit-license.php .
|
// file COPYING or https://www.opensource.org/licenses/mit-license.php .
|
||||||
|
|
||||||
#include "asyncrpcqueue.h"
|
#include "asyncrpcqueue.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
static std::atomic<size_t> workerCounter(0);
|
static std::atomic<size_t> workerCounter(0);
|
||||||
|
|
||||||
|
@ -26,6 +27,8 @@ AsyncRPCQueue::~AsyncRPCQueue() {
|
||||||
* A worker will execute this method on a new thread
|
* A worker will execute this method on a new thread
|
||||||
*/
|
*/
|
||||||
void AsyncRPCQueue::run(size_t workerId) {
|
void AsyncRPCQueue::run(size_t workerId) {
|
||||||
|
std::string s = strprintf("zc-asyncrpc-%s", workerId);
|
||||||
|
RenameThread(s.c_str());
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
AsyncRPCOperationId key;
|
AsyncRPCOperationId key;
|
||||||
|
|
|
@ -43,6 +43,10 @@ static bool fDaemon;
|
||||||
|
|
||||||
void WaitForShutdown(boost::thread_group* threadGroup)
|
void WaitForShutdown(boost::thread_group* threadGroup)
|
||||||
{
|
{
|
||||||
|
// This is the main process thread, but after this point, all we do here is wait for
|
||||||
|
// shutdown, and then shut down the node.
|
||||||
|
RenameThread("zc-wait-to-stop");
|
||||||
|
|
||||||
bool fShutdown = ShutdownRequested();
|
bool fShutdown = ShutdownRequested();
|
||||||
// Tell the main threads to shutdown.
|
// Tell the main threads to shutdown.
|
||||||
while (!fShutdown)
|
while (!fShutdown)
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
#include "zmq/zmqnotificationinterface.h"
|
#include "zmq/zmqnotificationinterface.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <rust/init.h>
|
||||||
#include <rust/metrics.h>
|
#include <rust/metrics.h>
|
||||||
|
|
||||||
#include "librustzcash.h"
|
#include "librustzcash.h"
|
||||||
|
@ -1071,6 +1072,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
|
|
||||||
std::set_new_handler(new_handler_terminate);
|
std::set_new_handler(new_handler_terminate);
|
||||||
|
|
||||||
|
// Set up global Rayon threadpool.
|
||||||
|
zcashd_init_rayon_threadpool();
|
||||||
|
|
||||||
// ********************************************************* Step 2: parameter interactions
|
// ********************************************************* Step 2: parameter interactions
|
||||||
const CChainParams& chainparams = Params();
|
const CChainParams& chainparams = Params();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
// Copyright (c) 2022 The Zcash developers
|
||||||
|
// Distributed under the MIT software license, see the accompanying
|
||||||
|
// file COPYING or https://www.opensource.org/licenses/mit-license.php .
|
||||||
|
|
||||||
|
#ifndef ZCASH_RUST_INCLUDE_RUST_INIT_H
|
||||||
|
#define ZCASH_RUST_INCLUDE_RUST_INIT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Initializes the global Rayon threadpool.
|
||||||
|
void zcashd_init_rayon_threadpool();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // ZCASH_RUST_INCLUDE_RUST_INIT_H
|
|
@ -0,0 +1,7 @@
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn zcashd_init_rayon_threadpool() {
|
||||||
|
rayon::ThreadPoolBuilder::new()
|
||||||
|
.thread_name(|i| format!("zc-rayon-{}", i))
|
||||||
|
.build_global()
|
||||||
|
.expect("Only initialized once");
|
||||||
|
}
|
|
@ -77,6 +77,7 @@ mod builder_ffi;
|
||||||
mod history_ffi;
|
mod history_ffi;
|
||||||
mod incremental_merkle_tree;
|
mod incremental_merkle_tree;
|
||||||
mod incremental_merkle_tree_ffi;
|
mod incremental_merkle_tree_ffi;
|
||||||
|
mod init_ffi;
|
||||||
mod orchard_ffi;
|
mod orchard_ffi;
|
||||||
mod orchard_keys_ffi;
|
mod orchard_keys_ffi;
|
||||||
mod transaction_ffi;
|
mod transaction_ffi;
|
||||||
|
|
Loading…
Reference in New Issue