diff options
author | Florian Angeletti <florian.angeletti@inria.fr> | 2022-11-18 11:23:49 +0100 |
---|---|---|
committer | Florian Angeletti <florian.angeletti@inria.fr> | 2022-11-18 11:23:49 +0100 |
commit | 7c79659c7ceb64a5a720edb1d2f8f202e142fe96 (patch) | |
tree | 54d1146ca847e18fa03b48bab5e8a3d2123d94d0 /stdlib/ephemeron.mli | |
parent | 634c90eca47afbb214b89e10697cc9ca2dff90e2 (diff) | |
download | ocaml-7c79659c7ceb64a5a720edb1d2f8f202e142fe96.tar.gz |
stdlib: add an unsynchronized_access alert to mutable datatypes
Diffstat (limited to 'stdlib/ephemeron.mli')
-rw-r--r-- | stdlib/ephemeron.mli | 12 |
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 |