summaryrefslogtreecommitdiff
path: root/stdlib/ephemeron.mli
diff options
context:
space:
mode:
authorFlorian Angeletti <florian.angeletti@inria.fr>2022-11-18 11:23:49 +0100
committerFlorian Angeletti <florian.angeletti@inria.fr>2022-11-18 11:23:49 +0100
commit7c79659c7ceb64a5a720edb1d2f8f202e142fe96 (patch)
tree54d1146ca847e18fa03b48bab5e8a3d2123d94d0 /stdlib/ephemeron.mli
parent634c90eca47afbb214b89e10697cc9ca2dff90e2 (diff)
downloadocaml-7c79659c7ceb64a5a720edb1d2f8f202e142fe96.tar.gz
stdlib: add an unsynchronized_access alert to mutable datatypes
Diffstat (limited to 'stdlib/ephemeron.mli')
-rw-r--r--stdlib/ephemeron.mli12
1 files changed, 12 insertions, 0 deletions
diff --git a/stdlib/ephemeron.mli b/stdlib/ephemeron.mli
index d7805f86e3..9391a7d367 100644
--- a/stdlib/ephemeron.mli
+++ b/stdlib/ephemeron.mli
@@ -65,6 +65,18 @@
@since 4.03
*)
+(** {b Unsynchronized accesses} *)
+
+[@@@alert unsynchronized_access
+ "Unsynchronized accesses to weak hash tables are a programming error."
+]
+
+(**
+ Unsynchronized accesses to a weak hash table may lead to an invalid
+ weak hash table state. Thus, concurrent accesses to a buffer must be
+ synchronized (for instance with a {!Mutex.t}).
+*)
+
module type S = sig
(** Propose the same interface as usual hash table. However since
the bindings are weak, even if [mem h k] is true, a subsequent