summaryrefslogtreecommitdiffstats
path: root/tokio/src/sync/mutex.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2020-10-09 10:02:55 -0700
committerGitHub <noreply@github.com>2020-10-09 10:02:55 -0700
commitafe535283c68dec40c5fc7a810445e8c2380880f (patch)
tree41c0271db0ffc39662fac9a0cc957dee216a2bef /tokio/src/sync/mutex.rs
parentee597347c5e612611142ece09c79e55f2d243590 (diff)
fs: future proof `File` (#2930)
Changes inherent methods to take `&self` instead of `&mut self`. This brings the API in line with `std`. This patch is implemented by using a `tokio::sync::Mutex` to guard the internal `File` state. This is not an ideal implementation strategy doesn't make a big impact compared to having to dispatch operations to a background thread followed by a blocking syscall. In the future, the implementation can be improved as we explore async file-system APIs provided by the operating-system (iocp / io_uring). Closes #2927
Diffstat (limited to 'tokio/src/sync/mutex.rs')
-rw-r--r--tokio/src/sync/mutex.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/tokio/src/sync/mutex.rs b/tokio/src/sync/mutex.rs
index b2cf64d3..21e44ca9 100644
--- a/tokio/src/sync/mutex.rs
+++ b/tokio/src/sync/mutex.rs
@@ -1,3 +1,5 @@
+#![cfg_attr(not(feature = "sync"), allow(unreachable_pub, dead_code))]
+
use crate::sync::batch_semaphore as semaphore;
use std::cell::UnsafeCell;