pub struct LocalLockMutLocalDataHandle<T: Dist> { /* private fields */ }Expand description
Handle used to retrieve the aquired mutable local data LocalLockMutLocalData of a LocalLockArray
This handle must be awaited or blocked on to acquire the lock
Once awaited/blocked the handle will not return while any readers or writer currently has access to the lock
Returns an RAII guard which will drop the read access of the wrlock when dropped
§Examples
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let my_pe = world.my_pe();
let array: LocalLockArray<usize> = LocalLockArray::new(&world,100,Distribution::Cyclic).block();
let handle = array.write_local_data();
world.spawn(async move {
let mut local_data = handle.await;
local_data.iter_mut().for_each(|elem| *elem += my_pe);
});
let mut local_data = array.write_local_data().block();
local_data.iter_mut().for_each(|elem| *elem += my_pe);Implementations§
Source§impl<T: Dist> LocalLockMutLocalDataHandle<T>
impl<T: Dist> LocalLockMutLocalDataHandle<T>
Sourcepub fn block(self) -> LocalLockMutLocalData<T>
pub fn block(self) -> LocalLockMutLocalData<T>
Blocks the calling thread to retrieve the aquired mutable local data LocalLockMutLocalData of a LocalLockArray within a non async context
Returns an RAII guard which will drop the write access of the wrlock when dropped
§Examples
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let my_pe = world.my_pe();
let array: LocalLockArray<usize> = LocalLockArray::new(&world,100,Distribution::Cyclic).block();
let handle = array.write_local_data();
let mut local_data = handle.block();
local_data.iter_mut().for_each(|elem| *elem += my_pe);Sourcepub fn spawn(self) -> LamellarTask<LocalLockMutLocalData<T>> ⓘ
pub fn spawn(self) -> LamellarTask<LocalLockMutLocalData<T>> ⓘ
This method will spawn the associated active message to capture the lock and data on the work queue, initiating the operation.
This function returns a handle that can be used to wait for the operation to complete
§Examples
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let my_pe = world.my_pe();
let array: LocalLockArray<usize> = LocalLockArray::new(&world,100,Distribution::Cyclic).block();
let handle = array.write_local_data();
let task = handle.spawn(); // initiate getting the write lock
//do other work
let mut local_data = task.block();
local_data.iter_mut().for_each(|elem| *elem += my_pe);Trait Implementations§
Source§impl<T: Dist> Drop for LocalLockMutLocalDataHandle<T>
impl<T: Dist> Drop for LocalLockMutLocalDataHandle<T>
Source§impl<T: Dist> Future for LocalLockMutLocalDataHandle<T>
impl<T: Dist> Future for LocalLockMutLocalDataHandle<T>
impl<'pin, T: Dist> Unpin for LocalLockMutLocalDataHandle<T>where
PinnedFieldsOf<__LocalLockMutLocalDataHandle<'pin, T>>: Unpin,
Auto Trait Implementations§
impl<T> !RefUnwindSafe for LocalLockMutLocalDataHandle<T>
impl<T> !Sync for LocalLockMutLocalDataHandle<T>
impl<T> !UnwindSafe for LocalLockMutLocalDataHandle<T>
impl<T> Freeze for LocalLockMutLocalDataHandle<T>
impl<T> Send for LocalLockMutLocalDataHandle<T>
impl<T> UnsafeUnpin for LocalLockMutLocalDataHandle<T>
Blanket Implementations§
Source§impl<T, U> AsyncTeamInto<U> for Twhere
T: Send,
U: AsyncTeamFrom<T>,
impl<T, U> AsyncTeamInto<U> for Twhere
T: Send,
U: AsyncTeamFrom<T>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
Source§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
Source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f. Read moreSource§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
Source§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
Source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
Source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll will never again be called once it has
completed. This method can be used to turn any Future into a
FusedFuture. Read moreSource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Source§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
Source§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
Source§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
Source§fn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
Future<Output = T> into a
TryFuture<Ok = T, Error = ()>.Source§fn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
Future<Output = T> into a
TryFuture<Ok = T, Error = Never>.