Struct wasmer::externals::memory::SharedMemory
source · pub struct SharedMemory {
memory: Memory,
ops: Arc<dyn SharedMemoryOps + Send + Sync>,
}
Expand description
A handle that exposes operations only relevant for shared memories.
Enables interaction independent from the crate::Store
, and thus allows calling
some methods an instane is running.
NOTE: Not all methods are supported by all backends.
Fields§
§memory: Memory
§ops: Arc<dyn SharedMemoryOps + Send + Sync>
Implementations§
sourcepub(crate) fn new(
memory: Memory,
ops: impl SharedMemoryOps + Send + Sync + 'static
) -> Self
pub(crate) fn new( memory: Memory, ops: impl SharedMemoryOps + Send + Sync + 'static ) -> Self
Create a new handle from ops.
sourcepub fn notify(
&self,
location: MemoryLocation,
count: u32
) -> Result<u32, AtomicsError>
pub fn notify( &self, location: MemoryLocation, count: u32 ) -> Result<u32, AtomicsError>
Notify up to count
waiters waiting for the memory location.
sourcepub fn wait(
&self,
location: MemoryLocation,
timeout: Option<Duration>
) -> Result<u32, AtomicsError>
pub fn wait( &self, location: MemoryLocation, timeout: Option<Duration> ) -> Result<u32, AtomicsError>
Wait for the memory location to be notified.
sourcepub fn disable_atomics(&self) -> Result<(), MemoryError>
pub fn disable_atomics(&self) -> Result<(), MemoryError>
Disable atomics for this memory.
All subsequent atomic wait calls will produce a trap.
This can be used or forced shutdown of instances that continuously try to wait on atomics.
NOTE: this operation might not be supported by all memory implementations. In that case, this function will return an error.
sourcepub fn wake_all_atomic_waiters(&self) -> Result<(), MemoryError>
pub fn wake_all_atomic_waiters(&self) -> Result<(), MemoryError>
Wake up all atomic waiters.
This can be used to force-resume waiting execution.
NOTE: this operation might not be supported by all memory implementations. In that case, this function will return an error.
Trait Implementations§
source§fn clone(&self) -> SharedMemory
fn clone(&self) -> SharedMemory
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
Blanket Implementations§
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where
F: FnOnce(&Self) -> bool,
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more