move coop_lock to core library, and only on 5.xx

This commit is contained in:
Simon Cruanes 2024-04-23 10:18:11 -04:00
parent 6290cee6d8
commit 7ed2e6991c
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
5 changed files with 8 additions and 3 deletions

View file

@ -27,7 +27,7 @@ let rec lock_ (self : 'a t) : 'a =
let old = A.get self.st in
if old.locked then (
(* suspend and add myself to the [waiters] queue *)
Moonpool.Private.Suspend_.suspend
Suspend_.suspend
{
handle =
(fun ~run:_ ~resume k ->

View file

@ -5,8 +5,12 @@ type 'a t
val create : 'a -> 'a t
(** New lock *)
[@@@ifge 5.0]
val with_lock : 'a t -> ('a -> 'b) -> 'b
(** [with_lock lock f] calls [f] with the lock's content *)
(** [with_lock lock f] calls [f] with the lock's content. *)
val with_lock_update : 'a t -> ('a -> 'a * 'b) -> 'b
val with_try_lock : 'a t -> ('a option -> 'b) -> 'b
[@@@endif]

View file

@ -23,6 +23,7 @@ module Blocking_queue = Bb_queue
module Background_thread = Background_thread
module Bounded_queue = Bounded_queue
module Chan = Chan
module Coop_lock = Coop_lock
module Exn_bt = Exn_bt
module Fifo_pool = Fifo_pool
module Fut = Fut

View file

@ -75,6 +75,7 @@ val await : 'a Fut.t -> 'a
[@@@endif]
module Lock = Lock
module Coop_lock = Coop_lock
module Fut = Fut
module Chan = Chan
module Task_local_storage = Task_local_storage

View file

@ -8,6 +8,5 @@ module Fiber = Fiber
module Fls = Fls
module Handle = Handle
module Main = Main
module Coop_lock = Coop_lock
include Fiber
include Main