Add config option 'rpcasyncthreads' to specify number of async rpc workers. Default is 1.

This commit is contained in:
Simon
2016-08-19 12:25:33 -07:00
parent 2e6321a154
commit 8d08172d0d
2 changed files with 11 additions and 3 deletions

View File

@@ -746,9 +746,16 @@ void StartRPCThreads()
// Launch at least one async rpc worker
async_rpc_queue = std::make_shared<AsyncRPCQueue>();
async_rpc_queue->addWorker();
async_rpc_queue->addWorker();
async_rpc_queue->addWorker();
int n = GetArg("-rpcasyncthreads", 1);
if (n<1) {
LogPrintf("ERROR: Invalid value %d for -rpcasyncthreads. Must be at least 1.\n", n);
strerr = strprintf(_("An error occurred while setting up the Async RPC threads, invalid parameter value of %d (must be at least 1)."), n);
uiInterface.ThreadSafeMessageBox(strerr, "", CClientUIInterface::MSG_ERROR);
StartShutdown();
return;
}
for (int i = 0; i < n; i++)
async_rpc_queue->addWorker();
}