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

Intended unlock in kvs_update? #186

Open
Medowhill opened this issue Aug 19, 2022 · 0 comments
Open

Intended unlock in kvs_update? #186

Medowhill opened this issue Aug 19, 2022 · 0 comments

Comments

@Medowhill
Copy link

Hi. I'm a researcher working on concurrent programs written in C and completely new to this project.

While reading the code, I found the following part in kvs_update:

streem/src/kvs.c

Lines 113 to 119 in d022e83

pthread_mutex_unlock(&k->lock);
/* call function */
if (strm_funcall(strm, args[2], 1, &old, &val) == STRM_NG) {
pthread_mutex_unlock(&k->lock);
return STRM_NG;
}

After k->lock is released in 113, it's released again in line 117. Unless strm_funcall returns after acquiring k->lock, line 117 would not be necessary. I don't fully understand the behavior of strm_funcall, but I can't find such cases yet. I'm wondering whether line 117 is intentional and necessary or could be removed.

Thank you.

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