From 9afb8e29e22a49f271f06144a1799de40c59a415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reynir=20Bj=C3=B6rnsson?= Date: Tue, 29 Oct 2024 10:10:17 +0100 Subject: [PATCH] Document change_and_push_waiter details --- src/git_kv.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/git_kv.ml b/src/git_kv.ml index 33fa5fc..a510974 100644 --- a/src/git_kv.ml +++ b/src/git_kv.ml @@ -679,7 +679,11 @@ module Make (Pclock : Mirage_clock.PCLOCK) = struct | None -> (* XXX(dinosaure): serialize [change_and_push]. If we do [Lwt.both (change_and_push ..) (change_and_push ..)], they can not run - concurrently! The second will waiting the first to finish. *) + concurrently! The second will waiting the first to finish. + (reynir): Furthermore, we need to create a new task and update + [change_and_push_waiter] before we wait on the existing + [change_and_push_waiter] task without any yield point in between to + ensure serializability. *) let th, wk = Lwt.wait () in let th' = t.change_and_push_waiter in t.change_and_push_waiter <- Some th;