-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling more then one priority_task_system instance #519
Comments
I already talked with him verbally about this problem. |
Just for the record: the issue has been resolved on our side (with the help of @FelixPetriconi) by copying over the |
The best answer here is to build your dynamic libraries with default visibility. Another option would be to provide an export list to the linker for all the stlab namespace symbols ( I'd consider a PR the used |
Thanks - yes, we are building all libraries with the same version and configuration. |
Yes, linking with default visibility would fix it. All template instantiations are marked as "inline" to the linker so the linker will use the first instance it sees in all locations. If you are not linking with default visibility you are almost certainly causing (other) ODR violations as well. |
Thank you, I will look into it! |
We use
stlab
in several compilation units, which results inpriority_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 usingstlab::await()
in another compilation unit, resulting in crashes on shutdown, aspre_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 inawait
.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 thepts
, for example by adding it as an optional parameter toawait
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 differentso
s. This is is also only a problem under linux, as Windows and macOs use the system thread pool and do not use the singleton.The text was updated successfully, but these errors were encountered: