Commit 24344df 1 parent 14c17fc commit 24344df Copy full SHA for 24344df
File tree 1 file changed +10
-5
lines changed
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -190,11 +190,13 @@ impl Driver {
190
190
assert ! ( !handle. is_shutdown( ) ) ;
191
191
192
192
// Finds out the min expiration time to park.
193
- let expiration_time = ( 0 ..rt_handle. time ( ) . inner . get_shard_size ( ) )
194
- . filter_map ( |id| {
195
- let lock = rt_handle. time ( ) . inner . lock_sharded_wheel ( id) ;
196
- lock. next_expiration_time ( )
197
- } )
193
+ let locks = ( 0 ..rt_handle. time ( ) . inner . get_shard_size ( ) )
194
+ . map ( |id| rt_handle. time ( ) . inner . lock_sharded_wheel ( id) )
195
+ . collect :: < Vec < _ > > ( ) ;
196
+
197
+ let expiration_time = locks
198
+ . iter ( )
199
+ . filter_map ( |lock| lock. next_expiration_time ( ) )
198
200
. min ( ) ;
199
201
200
202
rt_handle
@@ -203,6 +205,9 @@ impl Driver {
203
205
. next_wake
204
206
. store ( next_wake_time ( expiration_time) ) ;
205
207
208
+ // Safety: After updating the `next_wake`, we drop all the locks.
209
+ drop ( locks) ;
210
+
206
211
match expiration_time {
207
212
Some ( when) => {
208
213
let now = handle. time_source . now ( rt_handle. clock ( ) ) ;
You can’t perform that action at this time.
0 commit comments