From 242a72017d01c6ec7057b7846cd1316715026deb Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Mon, 11 Dec 2023 17:29:18 +0000 Subject: [PATCH] actually require it to be a Send future --- repro-problem/src/main.rs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/repro-problem/src/main.rs b/repro-problem/src/main.rs index b029850d84..d68c34c39c 100644 --- a/repro-problem/src/main.rs +++ b/repro-problem/src/main.rs @@ -8,19 +8,21 @@ mod virtual_file; async fn main() { page_cache::init(10); - let cache = page_cache::get(); + tokio::spawn(async move { + let cache = page_cache::get(); - let res = cache - .read_immutable_buf(page_cache::next_file_id(), 0) - .await - .unwrap(); - match res { - page_cache::ReadBufResult::Found(found) => todo!(), - page_cache::ReadBufResult::NotFound(write_guard) => { - let file = VirtualFile::open(camino::Utf8Path::new("foo")) - .await - .unwrap(); - file.read_exact_at(write_guard, 0).await; + let res = cache + .read_immutable_buf(page_cache::next_file_id(), 0) + .await + .unwrap(); + match res { + page_cache::ReadBufResult::Found(found) => todo!(), + page_cache::ReadBufResult::NotFound(write_guard) => { + let file = VirtualFile::open(camino::Utf8Path::new("foo")) + .await + .unwrap(); + file.read_exact_at(write_guard, 0).await; + } } - } + }); }