about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2018-09-01 18:00:10 +0200
committerRalf Jung <post@ralfj.de>2018-09-01 18:00:10 +0200
commitbc809e01eece1ec55adc781d25e54feac903157a (patch)
treef59796d82df49f6b9b7904ebead9e56c6b4f10fb
parent755de3c6848a5abf9e20ee9e866e04a1e711d8b8 (diff)
downloadrust-bc809e01eece1ec55adc781d25e54feac903157a.tar.gz
rust-bc809e01eece1ec55adc781d25e54feac903157a.zip
remark on concurrency in validity section
-rw-r--r--src/libcore/ptr.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 3f117ff612e..5c16c8acae5 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -28,6 +28,12 @@
 //! * A [null] pointer is *never* valid, not even for accesses of [size zero][zst].
 //! * All pointers (except for the null pointer) are valid for all operations of
 //!   [size zero][zst].
+//! * All accesses performed by functions in this module are *non-atomic* in the sense
+//!   of [atomic operations] used to synchronize between threads. This means it is
+//!   undefined behavior to perform two concurrent accesses to the same location from different
+//!   threads unless both accesses only read from memory. Notice that this explicitly
+//!   includes [`read_volatile`] and [`write_volatile`]: Volatile accesses cannot
+//!   be used for inter-thread synchronization.
 //! * The result of casting a reference to a pointer is valid for as long as the
 //!   underlying object is live and no reference (just raw pointers) is used to
 //!   access the same memory.
@@ -56,10 +62,13 @@
 //! [ub]: ../../reference/behavior-considered-undefined.html
 //! [null]: ./fn.null.html
 //! [zst]: ../../nomicon/exotic-sizes.html#zero-sized-types-zsts
+//! [atomic operations]: ../../std/sync/atomic/index.html
 //! [`copy`]: ../../std/ptr/fn.copy.html
 //! [`offset`]: ../../std/primitive.pointer.html#method.offset
 //! [`read_unaligned`]: ./fn.read_unaligned.html
 //! [`write_unaligned`]: ./fn.write_unaligned.html
+//! [`read_volatile`]: ./fn.read_volatile.html
+//! [`write_volatile`]: ./fn.write_volatile.html
 //! [`NonNull::dangling`]: ./struct.NonNull.html#method.dangling
 
 #![stable(feature = "rust1", since = "1.0.0")]