[−][src]Struct swym_htm::HardwareTx
A hardware memory transaction.
On drop, the transaction is committed.
Methods
impl HardwareTx
[src]
pub unsafe fn new<F, E>(retry_handler: F) -> Result<Self, E> where
F: FnMut(BeginCode) -> Result<(), E>,
[src]
F: FnMut(BeginCode) -> Result<(), E>,
Starts a new hardware transaction.
Takes a retry handler which is called on transaction abort. If the retry handler returns
Ok(())
, the transaction is retried. Any Err
is passed back to the location where new
was called.
The retry handler is never called with BeginCode
s where code.is_started() == true
.
Safety
It is unsafe to pass in a retry handler that never returns Err
. It is also unsafe to leak
the transaction, unless end
is manually called sometime after.
pub fn abort(&self) -> !
[src]
Aborts the current transaction.
Aborting a hardware transaction will effectively reset the thread/call stack to the location where new was called, passing control to the retry handler.
Even though this never returns, it does not panic.
Trait Implementations
impl Drop for HardwareTx
[src]
impl Debug for HardwareTx
[src]
Auto Trait Implementations
impl !Send for HardwareTx
impl !Sync for HardwareTx
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,