mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 11:15:38 -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
|
||||
set key x;
|
||||
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 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 *)
|
||||
module Direct : sig
|
||||
val get : t -> 'a key -> 'a
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue