robur-coop / miou

A simple scheduler for OCaml 5
https://docs.osau.re/miou/index.html
MIT License
93 stars 7 forks source link

Improve the `Miou_unix.Cond` API #7

Closed dinosaure closed 1 year ago

dinosaure commented 1 year ago

/cc @darrenldl, a fix for #5

Currently, Conditions in Miou are a bit different than usual. Internally, we use a pipe() to allow the inter-processs communication. I made a first short about the API where I did not really figure out about details. This PR specify the API and the documentation according to implementation details.

For instance, we should not have spurious wakeups when we actually try to read into our pipe(). However, I kept the same semantic than POSIX condition: if we signal a condition but nobody waits, we do nothing. t02 shows an usual usage of Miou_unix.Cond, we must have a mutex to check a predicate. It's like what the API provides: Miou_unix.Cond.until.

dinosaure commented 1 year ago

Merged here: https://git.robur.coop/robur/miou/pulls/18