Draft: introduce vtkAsioRunLoop and vtkAsioServiceThread
previously vtkAsioService::GetRunLoopScheduler()
would return a worker on a different thread each time. This could be a problem since we are accessing thread-unware API (VTK) from different threads. This also allow us to use many vtkProvider while making sure we use the same thread.
Moreover we can benefit from such constructs for providing schedulers for special threads like the main thread in cases like async/paraview!239
This MR introduces two new classes to resolve this issue.
-
vtkAsioRunLoop
is constructed by providing anasio::io_context
. The thread executingio_context.run()
is the one to execute any events scheduled on this run loop. -
vtkAsioServiceThread
(not really big fun of the name, open to suggestions ;) ) . An abstraction of a thread that handles creating astd::thread
, pairing it with anasio::io_context
, constructing avtkAsioRunLoop
and exposing the associated scheduler.
A test is added that fails on the current code but passes with this MR.
Depends on async/paraview!264