Finishing vtkThreadedCallbackQueue
This MR updates a few things in vtkThreadedCallbackQueue
- Changing SetNumberOfThreads behavior:
vtkThreadedCallbackQueue::SetNumberOfThreads
used to stop all running
threads, then allocate new threads but not run them. The user would have
had to restart the threads. As a consequence, we go from a state of n
threads to a state of zero threads to a state of m
threads. Ideally,
we'd like the transition to be smoother so we just directly go from n
to m
threads.
The method has been updated to behave like the latter scenario.
SerialStop
is not needed anymore either so it is removed.
- Encapsulating the thread worker:
The thread routine has been moved to its dedicated worker, making the
code cleaner with dedicated methods only relevant to the thread moved
to ThreadWorker
, such as
Pop()
and the new methods OnHold()
and Continue()
. Since the
ThreadWorker
needs access to private members of
vtkThreadedCallbackQueue
, it is declared friend
.
- Renaming Worker to Invoker:
It makes more sense to call them Invoker rather than Worker. They just invoke functions that do the work