Skip to content
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

pullValue should not return a value #35

Closed
jcelerier opened this issue Mar 29, 2016 · 0 comments
Closed

pullValue should not return a value #35

jcelerier opened this issue Mar 29, 2016 · 0 comments

Comments

@jcelerier
Copy link
Member

It is entirely unsafe, since it can return a value that will then be deleted from another thread, before the one who called pullValue has the time to clone it.
Hence one should always do :

address->pullValue();
auto theValue = address->cloneValue();

For the same reasons, getValue() should not be used (maybe cloneValue should become getValue ?).
Another safe option would be to store the value in a shared_ptr and change the API to return it as a shared_ptr, but I don't know what would be the best performance-wise between these two options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant