mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
add CCThread.spawn{1,2}
This commit is contained in:
parent
32fad92be8
commit
40c38a5dab
2 changed files with 13 additions and 1 deletions
|
|
@ -6,6 +6,10 @@ type t = Thread.t
|
|||
|
||||
let spawn f = Thread.create f ()
|
||||
|
||||
let spawn1 f x = Thread.create f x
|
||||
|
||||
let spawn2 f x y = Thread.create (fun () -> f x y) ()
|
||||
|
||||
let detach f = ignore (Thread.create f ())
|
||||
|
||||
module Arr = struct
|
||||
|
|
|
|||
|
|
@ -7,9 +7,17 @@
|
|||
|
||||
type t = Thread.t
|
||||
|
||||
val spawn : (unit -> 'a) -> t
|
||||
val spawn : (unit -> _) -> t
|
||||
(** [spawn f] creates a new thread that runs [f ()] *)
|
||||
|
||||
val spawn1 : ('a -> _) -> 'a -> t
|
||||
(** [spawn1 f x] is like [spawn (fun () -> f x)].
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val spawn2 : ('a -> 'b -> _) -> 'a -> 'b -> t
|
||||
(** [spawn2 f x y] is like [spawn (fun () -> f x y)].
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val detach : (unit -> 'a) -> unit
|
||||
(** [detach f] is the same as [ignore (spawn f)] *)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue