ocaml-multicore / domainslib

Parallel Programming over Domains
ISC License
171 stars 30 forks source link

Fix a benign data-race in Chan reported by ocaml-tsan #103

Closed art-w closed 1 year ago

art-w commented 1 year ago

tsan thinks that the previous code looked weird and I tend to agree (but I'm guessing it can't actually go bad?)

Now to confuse the reviewers and for context, the ref updates outside the mutex was introduced in https://github.com/ocaml-multicore/domainslib/pull/24 (https://github.com/ocaml-multicore/domainslib/pull/24/commits/e81e1f5d866196b1fe4c00f86d3315e7b9caa9a6), so there might be reasons for doing it that way? (cc @ctk21 in case you remember) (Should we rather switch the ref to an atomic?)

kayceesrk commented 1 year ago

Thanks @art-w.