mirror of
https://github.com/mii443/rust-openvr.git
synced 2025-08-22 16:25:36 +00:00
More Send/Sync
This commit is contained in:
@ -28,6 +28,8 @@ pub mod vulkan {
|
||||
pub format: u32,
|
||||
pub sample_count: u32,
|
||||
}
|
||||
unsafe impl Send for Texture{}
|
||||
unsafe impl Sync for Texture{}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
|
11
src/lib.rs
11
src/lib.rs
@ -52,9 +52,7 @@ pub unsafe fn init(ty: ApplicationType) -> Result<Context, InitError> {
|
||||
sys::EVRInitError_VRInitError_Init_InterfaceNotFound,
|
||||
));
|
||||
}
|
||||
Ok(Context {
|
||||
live: Cell::new(true),
|
||||
})
|
||||
Ok(Context { live: AtomicBool::new(true) })
|
||||
}
|
||||
|
||||
pub struct System(&'static sys::VR_IVRSystem_FnTable);
|
||||
@ -67,9 +65,7 @@ pub struct Chaperone(&'static sys::VR_IVRChaperone_FnTable);
|
||||
/// At most one of this object may exist at a time.
|
||||
///
|
||||
/// See safety notes in `init`.
|
||||
pub struct Context {
|
||||
live: Cell<bool>,
|
||||
}
|
||||
pub struct Context { live: AtomicBool }
|
||||
|
||||
fn load<T>(suffix: &[u8]) -> Result<*const T, InitError> {
|
||||
let mut magic = Vec::from(b"FnTable:".as_ref());
|
||||
@ -116,9 +112,10 @@ impl Context {
|
||||
/// attempting to free graphics resources.
|
||||
///
|
||||
/// No calls to other OpenVR methods may be made after this has been called unless a new `Context` is first
|
||||
|
||||
/// constructed.
|
||||
pub unsafe fn shutdown(&self) {
|
||||
if self.live.replace(false) {
|
||||
if self.live.swap(false, Ordering::Acquire) {
|
||||
sys::VR_ShutdownInternal();
|
||||
INITIALIZED.store(false, Ordering::Release);
|
||||
}
|
||||
|
Reference in New Issue
Block a user