Struct wasmer::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 more