File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030
3131*)
3232
33+ (* * {b Unsynchronized accesses} *)
34+
35+ [@@@ alert unsynchronized_access
36+ " Unsynchronized accesses to buffers are a programming error."
37+ ]
38+
39+ (* *
40+ Unsynchronized accesses to a buffer may lead to an invalid buffer state.
41+ Thus, concurrent accesses to a buffer must be synchronized (for instance
42+ with a {!Mutex.t}).
43+ *)
44+
3345type t
3446(* * The abstract type of buffers. *)
3547
Original file line number Diff line number Diff line change 6565 @since 4.03
6666*)
6767
68+ (* * {b Unsynchronized accesses} *)
69+
70+ [@@@ alert unsynchronized_access
71+ " Unsynchronized accesses to weak hash tables are a programming error."
72+ ]
73+
74+ (* *
75+ Unsynchronized accesses to a weak hash table may lead to an invalid
76+ weak hash table state. Thus, concurrent accesses to a buffer must be
77+ synchronized (for instance with a {!Mutex.t}).
78+ *)
79+
6880module type S = sig
6981 (* * Propose the same interface as usual hash table. However since
7082 the bindings are weak, even if [mem h k] is true, a subsequent
Original file line number Diff line number Diff line change 4141 See {{!examples} the examples section}.
4242*)
4343
44+ (* * {b Unsynchronized accesses} *)
45+
46+ [@@@ alert unsynchronized_access
47+ " Unsynchronized accesses to hash tables are a programming error."
48+ ]
49+
50+ (* *
51+ Unsynchronized accesses to a hash table may lead to an invalid hash table
52+ state. Thus, concurrent accesses to a hash tables must be synchronized
53+ (for instance with a {!Mutex.t}).
54+ *)
55+
4456
4557(* * {1 Generic interface} *)
4658
Original file line number Diff line number Diff line change @@ -58,6 +58,18 @@ module Hashtbl : sig
5858 See {{!examples} the examples section}.
5959 *)
6060
61+ (* * {b Unsynchronized accesses} *)
62+
63+ [@@@ alert unsynchronized_access
64+ " Unsynchronized accesses to hash tables are a programming error."
65+ ]
66+
67+ (* *
68+ Unsynchronized accesses to a hash table may lead to an invalid hash table
69+ state. Thus, concurrent accesses to a hash tables must be synchronized
70+ (for instance with a {!Mutex.t}).
71+ *)
72+
6173
6274 (* * {1 Generic interface} *)
6375
Original file line number Diff line number Diff line change 1515
1616(* * Operations on objects *)
1717
18- val copy : (< .. > as 'a ) -> 'a
1918(* * [Oo.copy o] returns a copy of object [o], that is a fresh
2019 object with the same methods and instance variables as [o]. *)
20+ val copy : (< .. > as 'a ) -> 'a
21+ [@@ alert unsynchronized_access
22+ "Unsynchronized accesses to mutable objects are a programming error."
23+ ]
2124
2225external id : < .. > -> int = " %field1"
2326(* * Return an integer identifying this object, unique for
Original file line number Diff line number Diff line change 1717
1818 This module implements queues (FIFOs), with in-place modification.
1919 See {{!examples} the example section} below.
20+ *)
21+
22+ (* * {b Unsynchronized accesses} *)
23+
24+ [@@@ alert unsynchronized_access
25+ " Unsynchronized accesses to queues are a programming error."
26+ ]
2027
21- {b Warning} This module is not thread-safe: each {!Queue.t} value
22- must be protected from concurrent access (e.g. with a [Mutex.t]).
23- Failure to do so can lead to a crash.
28+ (* *
29+ Unsynchronized accesses to a queue may lead to an invalid queue state.
30+ Thus, concurrent accesses to queues must be synchronized (for instance
31+ with a {!Mutex.t}).
2432*)
2533
2634type !'a t
Original file line number Diff line number Diff line change 8181 facility is fully type-checked at compile time.
8282*)
8383
84- (* * {2 Note on concurrent use } *)
84+ (* * {b Unsynchronized accesses } *)
8585
86- (* * Since values of type {!Scanning.in_channel} contain inner mutable states,
87- they are not safe to use concurrently without external synchronization.
86+ [@@@ alert unsynchronized_access
87+ " Unsynchronized accesses to Scanning.in_channel are a programming error."
88+ ]
89+
90+ (* *
91+ Unsynchronized accesses to a {!Scanning.in_channel} may lead to an
92+ invalid {!Scanning.in_channel} state. Thus, concurrent accesses
93+ to {!Scanning.in_channel}s must be synchronized (for instance with
94+ a {!Mutex.t}).
8895*)
8996
9097(* * {1 Formatted input channel} *)
Original file line number Diff line number Diff line change 1818 This module implements stacks (LIFOs), with in-place modification.
1919*)
2020
21+ (* * {b Unsynchronized accesses} *)
22+
23+ [@@@ alert unsynchronized_accesses
24+ " Unsynchronized accesses to stacks are a programming error."
25+ ]
26+
27+ (* *
28+ Unsynchronized accesses to a stack may lead to an invalid queue state.
29+ Thus, concurrent accesses to stacks must be synchronized (for instance
30+ with a {!Mutex.t}).
31+ *)
32+
2133type !'a t
2234(* * The type of stacks containing elements of type ['a]. *)
2335
Original file line number Diff line number Diff line change 4141 See {{!examples} the examples section}.
4242*)
4343
44+ (* * {b Unsynchronized accesses} *)
45+
46+ [@@@ alert unsynchronized_access
47+ " Unsynchronized accesses to hash tables are a programming error."
48+ ]
49+
50+ (* *
51+ Unsynchronized accesses to a hash table may lead to an invalid hash table
52+ state. Thus, concurrent accesses to a hash tables must be synchronized
53+ (for instance with a {!Mutex.t}).
54+ *)
55+
4456
4557(* * {1 Generic interface} *)
4658
Original file line number Diff line number Diff line change @@ -114,6 +114,14 @@ val blit : 'a t -> int -> 'a t -> int -> int -> unit
114114 the values and give the same result as with the values themselves.
115115 *)
116116
117+ (* * {b Unsynchronized accesses}
118+
119+ Unsynchronized accesses to weak hash sets are a programming error.
120+ Unsynchronized accesses to a weak hash set may lead to an invalid weak hash
121+ set state. Thus, concurrent accesses to weak hash sets must be synchronized
122+ (for instance with a {!Mutex.t}).
123+ *)
124+
117125module type S = sig
118126 type data
119127 (* * The type of the elements stored in the table. *)
You can’t perform that action at this time.
0 commit comments