File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ impl Drop for Driver {
126
126
while self . num_operations ( ) > 0 {
127
127
// If waiting fails, ignore the error. The wait will be attempted
128
128
// again on the next loop.
129
- _ = self . wait ( ) ;
129
+ let _ = self . wait ( ) ;
130
130
self . tick ( ) ;
131
131
}
132
132
}
Original file line number Diff line number Diff line change @@ -24,6 +24,15 @@ pub struct Runtime {
24
24
25
25
/// Tokio runtime, always current-thread
26
26
rt : tokio:: runtime:: Runtime ,
27
+
28
+ /// This is here for drop order reasons.
29
+ ///
30
+ /// We can't unset the driver in the runtime drop method, because the inner runtime needs to
31
+ /// be dropped first so that there are no tasks running.
32
+ ///
33
+ /// The rust drop order rules guarantee that the inner runtime will be dropped first, and
34
+ /// this last.
35
+ _driver_guard : RuntimeContextGuard ,
27
36
}
28
37
29
38
/// Spawns a new asynchronous task, returning a [`JoinHandle`] for it.
@@ -80,6 +89,7 @@ impl Runtime {
80
89
uring_fd : driver_fd,
81
90
local,
82
91
rt,
92
+ _driver_guard : RuntimeContextGuard ,
83
93
} )
84
94
}
85
95
@@ -114,7 +124,9 @@ impl Runtime {
114
124
}
115
125
}
116
126
117
- impl Drop for Runtime {
127
+ struct RuntimeContextGuard ;
128
+
129
+ impl Drop for RuntimeContextGuard {
118
130
fn drop ( & mut self ) {
119
131
CONTEXT . with ( |rc| rc. unset_driver ( ) )
120
132
}
You can’t perform that action at this time.
0 commit comments