use wasmer_types::MemoryError;
use crate::error::AtomicsError;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MemoryLocation {
pub(crate) address: u32,
}
impl MemoryLocation {
pub fn new_32(address: u32) -> Self {
Self { address }
}
}
impl From<u32> for MemoryLocation {
fn from(value: u32) -> Self {
Self::new_32(value)
}
}
pub(crate) trait SharedMemoryOps {
fn disable_atomics(&self) -> Result<(), MemoryError> {
Err(MemoryError::AtomicsNotSupported)
}
fn wake_all_atomic_waiters(&self) -> Result<(), MemoryError> {
Err(MemoryError::AtomicsNotSupported)
}
fn notify(&self, _dst: MemoryLocation, _count: u32) -> Result<u32, AtomicsError> {
Err(AtomicsError::Unimplemented)
}
fn wait(
&self,
_dst: MemoryLocation,
_timeout: Option<std::time::Duration>,
) -> Result<u32, AtomicsError> {
Err(AtomicsError::Unimplemented)
}
}