[][src]Struct swym_htm::HardwareTx

pub struct HardwareTx { /* fields omitted */ }

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]

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 BeginCodes 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]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.