Should MSQueue pop [1] return a (unit, 'a option) Reagent.t instead of retrying? Then, I can build a non-blocking pop using computed reagent as follows:
let rec pop_nb (q : 'a t) : (unit, 'a) Reagent.t =
pop q >> Reagent.computed (fun v =>
match v with
| Some v -> Reagent.constant v
| None -> Reagent.retry)
Should MSQueue
pop
[1] return a(unit, 'a option) Reagent.t
instead of retrying? Then, I can build a non-blocking pop using computed reagent as follows:[1] https://github.com/theolaurent/ocaml-reagent/blob/master/core/MSQueue.mli#L8