Commit graph

8 commits

Author SHA1 Message Date
Matt Corallo
1f668b6468 Expose if CScheduler is being serviced, assert its not in EmptyQueue 2017-07-10 21:08:19 -04:00
Matt Corallo
3192975f1d Flush CValidationInterface callbacks prior to destruction
Note that the CScheduler thread cant be running at this point,
it has already been stopped with the rest of the init threadgroup.
Thus, just calling any remaining loose callbacks during Shutdown()
is sane.
2017-07-07 12:55:57 -04:00
Matt Corallo
08096bbbc6 Support more than one CScheduler thread for serial clients
This will be used by CValidationInterface soon.

This requires a bit of work as we need to ensure that most of our
callbacks happen in-order (to avoid synchronization issues in
wallet) - we keep our own internal queue and push things onto it,
scheduling a queue-draining function immediately upon new
callbacks.
2017-07-07 11:33:18 -04:00
Matt Corallo
2fbf2dbe15 Add default arg to CScheduler to schedule() a callback now 2017-07-07 11:33:18 -04:00
practicalswift
1b936f5926 Replace boost::function with std::function (C++11) 2017-05-13 17:59:09 +02:00
Matt Corallo
73296f54d6 CScheduler boost->std::function, use millisecs for times, not secs 2017-03-06 18:33:50 -05:00
Gavin Andresen
f50105486f
More robust CScheduler unit test
On a busy or slow system, the CScheduler unit test could fail because it
assumed all threads would be done after a couple of milliseconds.

Replace the hard-coded sleep with CScheduler stop() method that
will cleanly exit the servicing threads when all tasks are completely
finished.
2015-05-16 17:59:23 -04:00
Gavin Andresen
928b950e3b
CScheduler class for lightweight task scheduling
Simple class to manage a task queue that is serviced by one or
more threads.
2015-05-14 10:37:19 -04:00