mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-11 13:38:38 -05:00
move coop_lock to core library, and only on 5.xx
This commit is contained in:
parent
6290cee6d8
commit
7ed2e6991c
5 changed files with 8 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ let rec lock_ (self : 'a t) : 'a =
|
||||||
let old = A.get self.st in
|
let old = A.get self.st in
|
||||||
if old.locked then (
|
if old.locked then (
|
||||||
(* suspend and add myself to the [waiters] queue *)
|
(* suspend and add myself to the [waiters] queue *)
|
||||||
Moonpool.Private.Suspend_.suspend
|
Suspend_.suspend
|
||||||
{
|
{
|
||||||
handle =
|
handle =
|
||||||
(fun ~run:_ ~resume k ->
|
(fun ~run:_ ~resume k ->
|
||||||
|
|
@ -5,8 +5,12 @@ type 'a t
|
||||||
val create : 'a -> 'a t
|
val create : 'a -> 'a t
|
||||||
(** New lock *)
|
(** New lock *)
|
||||||
|
|
||||||
|
[@@@ifge 5.0]
|
||||||
|
|
||||||
val with_lock : 'a t -> ('a -> 'b) -> 'b
|
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_lock_update : 'a t -> ('a -> 'a * 'b) -> 'b
|
||||||
val with_try_lock : 'a t -> ('a option -> 'b) -> 'b
|
val with_try_lock : 'a t -> ('a option -> 'b) -> 'b
|
||||||
|
|
||||||
|
[@@@endif]
|
||||||
|
|
@ -23,6 +23,7 @@ module Blocking_queue = Bb_queue
|
||||||
module Background_thread = Background_thread
|
module Background_thread = Background_thread
|
||||||
module Bounded_queue = Bounded_queue
|
module Bounded_queue = Bounded_queue
|
||||||
module Chan = Chan
|
module Chan = Chan
|
||||||
|
module Coop_lock = Coop_lock
|
||||||
module Exn_bt = Exn_bt
|
module Exn_bt = Exn_bt
|
||||||
module Fifo_pool = Fifo_pool
|
module Fifo_pool = Fifo_pool
|
||||||
module Fut = Fut
|
module Fut = Fut
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ val await : 'a Fut.t -> 'a
|
||||||
[@@@endif]
|
[@@@endif]
|
||||||
|
|
||||||
module Lock = Lock
|
module Lock = Lock
|
||||||
|
module Coop_lock = Coop_lock
|
||||||
module Fut = Fut
|
module Fut = Fut
|
||||||
module Chan = Chan
|
module Chan = Chan
|
||||||
module Task_local_storage = Task_local_storage
|
module Task_local_storage = Task_local_storage
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,5 @@ module Fiber = Fiber
|
||||||
module Fls = Fls
|
module Fls = Fls
|
||||||
module Handle = Handle
|
module Handle = Handle
|
||||||
module Main = Main
|
module Main = Main
|
||||||
module Coop_lock = Coop_lock
|
|
||||||
include Fiber
|
include Fiber
|
||||||
include Main
|
include Main
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue