-
Notifications
You must be signed in to change notification settings - Fork 76
Description
We use stlab in several compilation units, which results in priority_task_system instanciated more than once.
This had partly been resolved by using wrapper executors for default_executor that reside in one compilation unit, but is still a problem if using stlab::await() in another compilation unit, resulting in crashes on shutdown, as pre_exit will be called only for one instance.
It is difficult to handle this the same way as default_executor due to the template parameter in await.
Is there a possibililty to ensure that always the same thread pool (aka priority_task_system instance) is used? If not, would it make sense to add the possibility to inject the pts, for example by adding it as an optional parameter to await and a couple of other functions?
Edit: The use of "compilation unit" here is probably misleading. What I actually mean are dynamic libraries, not single cpp files, e.g. stlab::await() is used in different sos. This is is also only a problem under linux, as Windows and macOs use the system thread pool and do not use the singleton.