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

Why KV list's update() method have no argument with Value to insert ? #170

Open
hvlad opened this issue Jul 25, 2021 · 0 comments
Open

Why KV list's update() method have no argument with Value to insert ? #170

hvlad opened this issue Jul 25, 2021 · 0 comments

Comments

@hvlad
Copy link

hvlad commented Jul 25, 2021

Is there any strong reason to not accept Value at update() ?

For example, MichaelKVList::insert() is declared as

        template <typename K, typename V>
        bool insert( K&& key, V&& val )

while there is no update() with V argument.

Yes, we could pass functor that will assing new value to the newly inserted item but there is time window between item insertion and functor execution when another thread could find just inserted item with empty second and all it can do is to spin until second will be initialized.

Why not pass V into update() ?
Am I missing something ?

hvlad added a commit to hvlad/libcds that referenced this issue Aug 9, 2021
It allows to insert pre-constructed value if key was not found in list.
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