pub struct LocalLockLocalDataHandle<T: Dist> { /* private fields */ }Expand description
Handle used to retrieve the aquired local data LocalLockLocalData 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 writer currently has access to the lock, but there may be other readers
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.read_local_data();
world.spawn(async move {
let local_data = handle.await;
println!("PE{my_pe}, local_data: {:?}", local_data);
});
let mut local_data = array.read_local_data().block();
println!("PE{my_pe}, local_data: {:?}", local_data);Implementations§
Source§impl<T: Dist> LocalLockLocalDataHandle<T>
impl<T: Dist> LocalLockLocalDataHandle<T>
Sourcepub fn block(self) -> LocalLockLocalData<T>
pub fn block(self) -> LocalLockLocalData<T>
Blocks the calling thread to retrieve the aquired local data LocalLockLocalData 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.read_local_data();
let local_data = handle.block();
println!("local data: {:?}",local_data);Sourcepub fn spawn(self) -> LamellarTask<LocalLockLocalData<T>> ⓘ
pub fn spawn(self) -> LamellarTask<LocalLockLocalData<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.read_local_data();
let task = handle.spawn(); // initiate getting the read lock
// do other work
let local_data = task.block();
println!("local data: {:?}",local_data);Trait Implementations§
Source§impl<T: Dist> Drop for LocalLockLocalDataHandle<T>
impl<T: Dist> Drop for LocalLockLocalDataHandle<T>
Source§impl<T: Dist> Future for LocalLockLocalDataHandle<T>
impl<T: Dist> Future for LocalLockLocalDataHandle<T>
impl<'pin, T: Dist> Unpin for LocalLockLocalDataHandle<T>where
PinnedFieldsOf<__LocalLockLocalDataHandle<'pin, T>>: Unpin,
Auto Trait Implementations§
impl<T> !RefUnwindSafe for LocalLockLocalDataHandle<T>
impl<T> !Sync for LocalLockLocalDataHandle<T>
impl<T> !UnwindSafe for LocalLockLocalDataHandle<T>
impl<T> Freeze for LocalLockLocalDataHandle<T>
impl<T> Send for LocalLockLocalDataHandle<T>
impl<T> UnsafeUnpin for LocalLockLocalDataHandle<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>.