diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2015-05-14 14:23:13 -0400 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2015-05-14 14:27:07 -0400 |
commit | b4c219b622235e66fecd5dee1883908d5336a6c0 (patch) | |
tree | aee090d0cd5cfd0023ec23c9295b587920527585 /src/util.h | |
parent | 339321522c5c8779ef1d4b1769b23ec7a69b18d9 (diff) | |
parent | 9a1dcea2df2a6a89acf79bc41972e937d783a080 (diff) | |
download | bitcoin-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/util.h')
-rw-r--r-- | src/util.h | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/util.h b/src/util.h index 483d9d7858..4cc0faf4d7 100644 --- a/src/util.h +++ b/src/util.h @@ -203,43 +203,6 @@ void SetThreadPriority(int nPriority); void RenameThread(const char* name); /** - * Standard wrapper for do-something-forever thread functions. - * "Forever" really means until the thread is interrupted. - * Use it like: - * new boost::thread(boost::bind(&LoopForever<void (*)()>, "dumpaddr", &DumpAddresses, 900000)); - * or maybe: - * boost::function<void()> f = boost::bind(&FunctionWithArg, argument); - * threadGroup.create_thread(boost::bind(&LoopForever<boost::function<void()> >, "nothing", f, milliseconds)); - */ -template <typename Callable> void LoopForever(const char* name, Callable func, int64_t msecs) -{ - std::string s = strprintf("bitcoin-%s", name); - RenameThread(s.c_str()); - LogPrintf("%s thread start\n", name); - try - { - while (1) - { - MilliSleep(msecs); - func(); - } - } - catch (const boost::thread_interrupted&) - { - LogPrintf("%s thread stop\n", name); - throw; - } - catch (const std::exception& e) { - PrintExceptionContinue(&e, name); - throw; - } - catch (...) { - PrintExceptionContinue(NULL, name); - throw; - } -} - -/** * .. and a wrapper that just calls func once */ template <typename Callable> void TraceThread(const char* name, Callable func) |