feat fib: spawn_ignore now has ?on optional param

close #33
This commit is contained in:
Simon Cruanes 2024-10-03 13:17:07 -04:00
parent 20245d11f3
commit a143cc8489
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 6 additions and 3 deletions

View file

@ -301,7 +301,9 @@ let spawn ?on ?(protect = true) f : _ t =
add_child_ ~protect p child; add_child_ ~protect p child;
child child
let[@inline] spawn_ignore ?protect f : unit = ignore (spawn ?protect f : _ t) let[@inline] spawn_ignore ?on ?protect f : unit =
ignore (spawn ?on ?protect f : _ t)
let[@inline] spawn_top_ignore ~on f : unit = ignore (spawn_top ~on f : _ t) let[@inline] spawn_top_ignore ~on f : unit = ignore (spawn_top ~on f : _ t)
let[@inline] self () : any = let[@inline] self () : any =

View file

@ -143,10 +143,11 @@ val spawn : ?on:Runner.t -> ?protect:bool -> (unit -> 'a) -> 'a t
Must be run from inside a fiber. Must be run from inside a fiber.
@raise Failure if not run from inside a fiber. *) @raise Failure if not run from inside a fiber. *)
val spawn_ignore : ?protect:bool -> (unit -> _) -> unit val spawn_ignore : ?on:Runner.t -> ?protect:bool -> (unit -> _) -> unit
(** [spawn_ignore f] is [ignore (spawn f)]. (** [spawn_ignore f] is [ignore (spawn f)].
The fiber will still affect termination of the parent, ie. the The fiber will still affect termination of the parent, ie. the
parent will exit only after this new fiber exits. *) parent will exit only after this new fiber exits.
@param on the optional runner to use, added since NEXT_RELEASE *)
val spawn_top_ignore : on:Runner.t -> (unit -> _) -> unit val spawn_top_ignore : on:Runner.t -> (unit -> _) -> unit
(** Like {!spawn_top} but ignores the result. (** Like {!spawn_top} but ignores the result.