Skip to content

Commit b27e89a

Browse files
sgrebnovlukekim
authored andcommitted
Use tokio::sync::oneshot to prevent FuturesUnordered reentrant drop crash (#9)
1 parent 3e251fb commit b27e89a

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

vortex-file/src/read/driver.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use std::task::Context;
88
use std::task::Poll;
99

1010
use futures::Stream;
11+
#[cfg(all(test, not(feature = "tokio")))]
12+
use oneshot;
1113
use pin_project_lite::pin_project;
1214
use vortex_buffer::Alignment;
1315
use vortex_error::VortexExpect;

vortex-io/src/runtime/single.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ use futures::Stream;
88
use futures::StreamExt;
99
use futures::future::BoxFuture;
1010
use futures::stream::LocalBoxStream;
11+
#[cfg(not(feature = "tokio"))]
12+
use oneshot;
1113
use parking_lot::Mutex;
1214
use smol::LocalExecutor;
15+
// Prefer tokio::sync::oneshot when tokio feature is enabled
16+
#[cfg(feature = "tokio")]
17+
use tokio::sync::oneshot;
1318
use vortex_error::vortex_panic;
1419

1520
use crate::runtime::AbortHandle;
@@ -18,7 +23,6 @@ use crate::runtime::BlockingRuntime;
1823
use crate::runtime::Executor;
1924
use crate::runtime::Handle;
2025
use crate::runtime::smol::SmolAbortHandle;
21-
2226
/// A runtime that drives all work on the current thread.
2327
///
2428
/// This is subtly different from using a current-thread runtime to drive a future since it is

0 commit comments

Comments
 (0)