1 use crate::cell::UnsafeCell;
5 inner: UnsafeCell<c::SRWLOCK>,
8 unsafe impl Send for RWLock {}
9 unsafe impl Sync for RWLock {}
12 pub const fn new() -> RWLock {
13 RWLock { inner: UnsafeCell::new(c::SRWLOCK_INIT) }
16 pub unsafe fn read(&self) {
17 c::AcquireSRWLockShared(self.inner.get())
20 pub unsafe fn try_read(&self) -> bool {
21 c::TryAcquireSRWLockShared(self.inner.get()) != 0
24 pub unsafe fn write(&self) {
25 c::AcquireSRWLockExclusive(self.inner.get())
28 pub unsafe fn try_write(&self) -> bool {
29 c::TryAcquireSRWLockExclusive(self.inner.get()) != 0
32 pub unsafe fn read_unlock(&self) {
33 c::ReleaseSRWLockShared(self.inner.get())
36 pub unsafe fn write_unlock(&self) {
37 c::ReleaseSRWLockExclusive(self.inner.get())
41 pub unsafe fn destroy(&self) {