Skip to content

Is basic_registry<>::view<> thread safe ? #1253

Answered by skypjack
TothBenoit asked this question in Q&A
Discussion options

You must be logged in to vote

In case of non-const views, they can trigger the creation of the underlying pools if they do not exist yet in the registry.
Pools are stored in a vector, so yeah, if you create non-const views from different threads using i.e. an empty registry, it's a race.
This is somehow mentioned here. The approach is the same of the standard library after all. Thread safety isn't guaranteed for non-const containers, and you're probably operating on a non-const registry here. Therefore, it's up to you to pre-create all required pools or properly guard view creation calls.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TothBenoit
Comment options

Answer selected by TothBenoit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question open question
2 participants