summaryrefslogtreecommitdiffstats
path: root/tokio/src/util
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/util
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/util')
-rw-r--r--tokio/src/util/linked_list.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/tokio/src/util/linked_list.rs b/tokio/src/util/linked_list.rs
index 5073855e..5692743f 100644
--- a/tokio/src/util/linked_list.rs
+++ b/tokio/src/util/linked_list.rs
@@ -181,7 +181,12 @@ impl<L: Link> fmt::Debug for LinkedList<L, L::Target> {
}
}
-#[cfg(any(feature = "sync", feature = "signal", feature = "process"))]
+#[cfg(any(
+ feature = "fs",
+ feature = "sync",
+ feature = "signal",
+ feature = "process"
+))]
impl<L: Link> LinkedList<L, L::Target> {
pub(crate) fn last(&self) -> Option<&L::Target> {
let tail = self.tail.as_ref()?;