diff --git a/src/lib.rs b/src/lib.rs index 6c5182d..de03cb9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,7 @@ extern crate std; use core::mem::{size_of, ManuallyDrop}; use core::ops::{Deref, DerefMut}; +use core::panic::UnwindSafe; use core::ptr::{self, NonNull}; /// A [`Box`]-like type that uses `mlock` to prevent paging the allocated memory @@ -62,6 +63,14 @@ impl LockedBox { } } +// SAFETY: This type adds no restrictions over whether it is Sync other than +// whether T is Sync. +unsafe impl Sync for LockedBox where T: Sync {} +// SAFETY: This type adds no restrictions over whether it is Send other than +// whether T is Send. +unsafe impl Send for LockedBox where T: Send {} +impl UnwindSafe for LockedBox where T: UnwindSafe {} + impl Deref for LockedBox { type Target = T;