Skip to content

Fix ordering of masterlock operations #2237

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

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ocaml/otherlibs/systhreads/st_pthreads.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ static void st_masterlock_release(st_masterlock * m)
m->busy = 0;
// CR ocaml 5 domains: we assume no backup thread
// st_bt_lock_release(m);
custom_condvar_signal(&m->is_free);
pthread_mutex_unlock(&m->lock);
custom_condvar_signal(&m->is_free);

return;
}
Expand Down Expand Up @@ -204,8 +204,8 @@ Caml_inline void st_thread_yield(st_masterlock * m)
}

m->busy = 0;
atomic_fetch_add(&m->waiters, +1);
custom_condvar_signal(&m->is_free);
atomic_fetch_add(&m->waiters, +1);
/* releasing the domain lock but not triggering bt messaging
messaging the bt should not be required because yield assumes
that a thread will resume execution (be it the yielding thread
Expand Down