From ec5ac645def086c3b14aea06c4dd2efb4c4e2563 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 3 Sep 2024 09:19:39 -0400 Subject: [PATCH] feat: add `Event.of_fut` --- src/sync/event.ml | 4 ++++ src/sync/event.mli | 5 +++++ src/sync/moonpool_sync.ml | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/sync/event.ml create mode 100644 src/sync/event.mli diff --git a/src/sync/event.ml b/src/sync/event.ml new file mode 100644 index 00000000..3ab78478 --- /dev/null +++ b/src/sync/event.ml @@ -0,0 +1,4 @@ +include Picos_std_event.Event + +let[@inline] of_fut (fut : _ Moonpool.Fut.t) : _ t = + from_computation (Moonpool.Fut.Private_.as_computation fut) diff --git a/src/sync/event.mli b/src/sync/event.mli new file mode 100644 index 00000000..6840433b --- /dev/null +++ b/src/sync/event.mli @@ -0,0 +1,5 @@ +include module type of struct + include Picos_std_event.Event +end + +val of_fut : 'a Moonpool.Fut.t -> 'a t diff --git a/src/sync/moonpool_sync.ml b/src/sync/moonpool_sync.ml index 2c5fe741..99065305 100644 --- a/src/sync/moonpool_sync.ml +++ b/src/sync/moonpool_sync.ml @@ -1,7 +1,7 @@ module Mutex = Picos_std_sync.Mutex module Condition = Picos_std_sync.Condition module Lock = Lock -module Event = Picos_std_event +module Event = Event module Semaphore = Picos_std_sync.Semaphore module Lazy = Picos_std_sync.Lazy module Latch = Picos_std_sync.Latch