aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2015-05-14 14:23:13 -0400
committerGavin Andresen <gavinandresen@gmail.com>2015-05-14 14:27:07 -0400
commitb4c219b622235e66fecd5dee1883908d5336a6c0 (patch)
treeaee090d0cd5cfd0023ec23c9295b587920527585 /src/init.cpp
parent339321522c5c8779ef1d4b1769b23ec7a69b18d9 (diff)
parent9a1dcea2df2a6a89acf79bc41972e937d783a080 (diff)
downloadbitcoin-b4c219b622235e66fecd5dee1883908d5336a6c0.tar.xz
Merge pull request #5964
9a1dcea Use CScheduler for net's DumpAddresses (Gavin Andresen) ddd0acd Create a scheduler thread for lightweight tasks (Gavin Andresen) 68d370b CScheduler unit test (Gavin Andresen) cfefe5b scheduler: fix with boost <= 1.50 (Cory Fields) ca66717 build: make libboost_chrono mandatory (Cory Fields) 928b950 CScheduler class for lightweight task scheduling (Gavin Andresen) e656560 [Qt] add defaultConfirmTarget constant to sendcoinsdialog (Philip Kaufmann)
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 6ef0ce4268..bacc938375 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -19,6 +19,7 @@
#include "net.h"
#include "rpcserver.h"
#include "script/standard.h"
+#include "scheduler.h"
#include "txdb.h"
#include "ui_interface.h"
#include "util.h"
@@ -564,7 +565,7 @@ bool InitSanityCheck(void)
/** Initialize bitcoin.
* @pre Parameters should be parsed and config file should be read.
*/
-bool AppInit2(boost::thread_group& threadGroup)
+bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
{
// ********************************************************* Step 1: setup
#ifdef _MSC_VER
@@ -890,6 +891,10 @@ bool AppInit2(boost::thread_group& threadGroup)
threadGroup.create_thread(&ThreadScriptCheck);
}
+ // Start the lightweight task scheduler thread
+ CScheduler::Function serviceLoop = boost::bind(&CScheduler::serviceQueue, &scheduler);
+ threadGroup.create_thread(boost::bind(&TraceThread<CScheduler::Function>, "scheduler", serviceLoop));
+
/* Start the RPC server already. It will be started in "warmup" mode
* and not really process calls already (but it will signify connections
* that the server is there and will be ready later). Warmup mode will
@@ -1373,7 +1378,7 @@ bool AppInit2(boost::thread_group& threadGroup)
LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0);
#endif
- StartNode(threadGroup);
+ StartNode(threadGroup, scheduler);
#ifdef ENABLE_WALLET
// Generate coins in the background