Update CodeMemory to be Send + Sync (#780)

* Update `CodeMemory` to be `Send + Sync`

This commit updates the `CodeMemory` type in wasmtime to be both `Send`
and `Sync` by updating the implementation of `Mmap` to not store raw
pointers. This avoids the need for an `unsafe impl` and leaves the
unsafety as it is currently.

* Run rustfmt

* Rename `offset` to `ptr`
This commit is contained in:
Alex Crichton
2020-01-09 16:22:49 -06:00
committed by GitHub
parent 9ee05447c7
commit 317f598969
2 changed files with 29 additions and 15 deletions

View File

@@ -14,6 +14,11 @@ pub struct CodeMemory {
published: usize,
}
fn _assert() {
fn _assert_send_sync<T: Send + Sync>() {}
_assert_send_sync::<CodeMemory>();
}
impl CodeMemory {
/// Create a new `CodeMemory` instance.
pub fn new() -> Self {