diff options
-rw-r--r-- | node/Node.hpp | 8 | ||||
-rw-r--r-- | service/OneService.cpp | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/node/Node.hpp b/node/Node.hpp index 800c0a55..76dec50e 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -130,6 +130,14 @@ public: // Internal functions ------------------------------------------------------ /** + * Convenience threadMain() for easy background thread launch + * + * This allows background threads to be launched with Thread::start + * that will run against this node. + */ + inline void threadMain() throw() { this->backgroundThreadMain(); } + + /** * @return Time as of last call to run() */ inline uint64_t now() const throw() { return _now; } diff --git a/service/OneService.cpp b/service/OneService.cpp index 8c8ff1ed..e0ead047 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -656,6 +656,10 @@ public: } } + // Start two background threads to handle expensive ops out of line + Thread::start(_node); + Thread::start(_node); + _nextBackgroundTaskDeadline = 0; uint64_t clockShouldBe = OSUtils::now(); _lastRestart = clockShouldBe; |