mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
expose Task_local_storage.get_current
This commit is contained in:
parent
45b8aa9999
commit
8c10c2b329
2 changed files with 6 additions and 0 deletions
|
|
@ -77,3 +77,5 @@ let with_value key x f =
|
||||||
let old = get key in
|
let old = get key in
|
||||||
set key x;
|
set key x;
|
||||||
Fun.protect ~finally:(fun () -> set key old) f
|
Fun.protect ~finally:(fun () -> set key old) f
|
||||||
|
|
||||||
|
let get_current = get_current_storage
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,10 @@ val with_value : 'a key -> 'a -> (unit -> 'b) -> 'b
|
||||||
to [f()]. When [f()] returns (or fails), [k] is restored
|
to [f()]. When [f()] returns (or fails), [k] is restored
|
||||||
to its old value. *)
|
to its old value. *)
|
||||||
|
|
||||||
|
val get_current : unit -> t option
|
||||||
|
(** Access the current storage, or [None] if not run from
|
||||||
|
within a task. *)
|
||||||
|
|
||||||
(** Direct access to values from a storage handle *)
|
(** Direct access to values from a storage handle *)
|
||||||
module Direct : sig
|
module Direct : sig
|
||||||
val get : t -> 'a key -> 'a
|
val get : t -> 'a key -> 'a
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue