silence dead code warnings on windows
This commit is contained in:
parent
55ca27faa7
commit
406fd3a277
1 changed files with 5 additions and 0 deletions
|
@ -1,12 +1,15 @@
|
||||||
use crate::sys::rwlock as imp;
|
use crate::sys::rwlock as imp;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
enum GuardType {
|
enum GuardType {
|
||||||
Read,
|
Read,
|
||||||
Write,
|
Write,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
pub struct RWLockGuard(&'static RWLock, GuardType);
|
pub struct RWLockGuard(&'static RWLock, GuardType);
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
impl Drop for RWLockGuard {
|
impl Drop for RWLockGuard {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -52,6 +55,7 @@ impl RWLock {
|
||||||
/// Behavior is undefined if the rwlock has been moved between this and any
|
/// Behavior is undefined if the rwlock has been moved between this and any
|
||||||
/// previous method call.
|
/// previous method call.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg(unix)]
|
||||||
pub unsafe fn read_with_guard(&'static self) -> RWLockGuard {
|
pub unsafe fn read_with_guard(&'static self) -> RWLockGuard {
|
||||||
self.read();
|
self.read();
|
||||||
RWLockGuard(&self, GuardType::Read)
|
RWLockGuard(&self, GuardType::Read)
|
||||||
|
@ -87,6 +91,7 @@ impl RWLock {
|
||||||
/// Behavior is undefined if the rwlock has been moved between this and any
|
/// Behavior is undefined if the rwlock has been moved between this and any
|
||||||
/// previous method call.
|
/// previous method call.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg(unix)]
|
||||||
pub unsafe fn write_with_guard(&'static self) -> RWLockGuard {
|
pub unsafe fn write_with_guard(&'static self) -> RWLockGuard {
|
||||||
self.write();
|
self.write();
|
||||||
RWLockGuard(&self, GuardType::Write)
|
RWLockGuard(&self, GuardType::Write)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue