Skip to content

Commit dc67a4d

Browse files
authored
Annotate 'a Domain.t as mod portable contended with 'a (#3829)
1 parent 033b218 commit dc67a4d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

stdlib/domain.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ module Runtime_4 = struct
127127
(* Unimplemented functions *)
128128
let not_implemented () =
129129
failwith "Multi-domain functionality not supported in runtime4"
130-
type !'a t
130+
type !'a t : value mod portable contended with 'a
131131
type id = int
132132
let spawn' _ = not_implemented ()
133133
let join _ = not_implemented ()
@@ -150,12 +150,12 @@ module Runtime_5 = struct
150150
| Running
151151
| Finished of ('a, exn) result [@warning "-unused-constructor"]
152152

153-
type 'a term_sync = {
153+
type 'a term_sync : value mod portable contended with 'a = {
154154
(* protected by [mut] *)
155155
mutable state : 'a state [@warning "-unused-field"] ;
156156
mut : Mutex.t ;
157157
cond : Condition.t ;
158-
}
158+
} [@@unsafe_allow_any_mode_crossing]
159159

160160
external spawn : (unit -> 'a) @ portable once -> 'a term_sync -> t @@ portable
161161
= "caml_domain_spawn"
@@ -472,7 +472,7 @@ module type S = sig
472472
val init : unit -> unit
473473
end
474474

475-
type !'a t
475+
type !'a t : value mod portable contended with 'a
476476
val spawn' : (DLS.Access.t -> 'a) @ portable once -> 'a t @@ portable
477477
val join : 'a t -> 'a @@ portable
478478
type id = private int

stdlib/domain.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
2828
@since 5.0 *)
2929

30-
type !'a t
30+
type !'a t : value mod portable contended with 'a
3131
(** A domain of type ['a t] runs independently, eventually producing a
3232
result of type 'a, or an exception *)
3333

0 commit comments

Comments
 (0)