#[repr(u8)]pub enum SyncOpt {
AcqRelOps = 0,
Fence = 1,
None = 2,
}Expand description
An enumeration of various synchronization options to use when performing
memory transfer operations with well_defined_copy_to / well_defined_copy_from.
§AcqRelOps
Use either Ordering::Acquire (CopyFrom) or Ordering::Release (CopyTo)
on every atomic load/store operation during the transfer to/from the shared
buffer.
§Fence
Use either an Ordering::Acquire thread fence (CopyFrom) after the transfer
operation, or an Ordering::Release (CopyTo) thread fence before the
operation, and Ordering::Relaxed for each of the atomic load/store
operations during the transfer.
§None
Simply use Ordering::Relaxed for each of the atomic load/store
operations during the transfer. Do not actually introduce any
explicit synchronization behavior.
WARNING: Use cases for this transfer mode tend to be unusual. Users will almost
always want some form of synchronization to take place during their
transfers. One example of where it may be appropriate to use SyncOpt::None
might be a situation where users are attempting to observe the state of more
than one object while inside of a sequence lock read transaction, and the
user has decided that it is better to use a thread fence than to use acquire
semantics on each element transferred. Such a sequence might look something
like this:
let mut foo1 = Foo::default();
let mut foo2 = Foo::default();
let mut bar1 = Bar::default();
let mut bar2 = Bar::default();
// ...
src_foo1.read::<SYNC_OPT_NONE>(&mut foo1);
src_foo2.read::<SYNC_OPT_NONE>(&mut foo2);
src_bar1.read::<SYNC_OPT_NONE>(&mut bar1);
src_bar2.read::<SYNC_OPT_FENCE>(&mut bar2);Note that it is the last transfer operation which includes the fence. In
the case of a CopyTo operation (when publishing data) it would be the first
operation which included the fence, not the last.
Variants§
Implementations§
Trait Implementations§
impl Copy for SyncOpt
impl Eq for SyncOpt
impl StructuralPartialEq for SyncOpt
Auto Trait Implementations§
impl Freeze for SyncOpt
impl RefUnwindSafe for SyncOpt
impl Send for SyncOpt
impl Sync for SyncOpt
impl Unpin for SyncOpt
impl UnsafeUnpin for SyncOpt
impl UnwindSafe for SyncOpt
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)