vtkThreadedCallbackQueue: introducing vtkCallbackTokens
vtkCallbackTokens
are now returned by Push
and the new CausalPush
method. They
embed a std::shared_future
which allows to synchronize code in the
main thread depending on whether certain functions have been executed or
not.
CausalPush
takes as input, in addition to the function and parameters,
a container of tokens. The pushed function through this method will only
execute when the functions associated with the tokens have all
terminated.
Currently, the thread taking charge of a function that needs to wait
before being executed just call the wait()
method of the future. There
could be a smarter way to do that by having multiple queues depending on
the readiness of functions.
Edited by Yohann Bearzi (Kitware)