File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ exclude = ["/.*"]
18
18
async-lock = " 2.6"
19
19
async-task = " 4.0.0"
20
20
concurrent-queue = " 2.0.0"
21
- fastrand = " 1.3.4 "
21
+ fastrand = " 2.0.0 "
22
22
futures-lite = " 1.11.0"
23
23
slab = " 0.4.4"
24
24
Original file line number Diff line number Diff line change @@ -227,12 +227,13 @@ impl<'a> Executor<'a> {
227
227
/// ```
228
228
pub async fn run < T > ( & self , future : impl Future < Output = T > ) -> T {
229
229
let runner = Runner :: new ( self . state ( ) ) ;
230
+ let mut rng = fastrand:: Rng :: new ( ) ;
230
231
231
232
// A future that runs tasks forever.
232
233
let run_forever = async {
233
234
loop {
234
235
for _ in 0 ..200 {
235
- let runnable = runner. runnable ( ) . await ;
236
+ let runnable = runner. runnable ( & mut rng ) . await ;
236
237
runnable. run ( ) ;
237
238
}
238
239
future:: yield_now ( ) . await ;
@@ -748,7 +749,7 @@ impl Runner<'_> {
748
749
}
749
750
750
751
/// Waits for the next runnable task to run.
751
- async fn runnable ( & self ) -> Runnable {
752
+ async fn runnable ( & self , rng : & mut fastrand :: Rng ) -> Runnable {
752
753
let runnable = self
753
754
. ticker
754
755
. runnable_with ( || {
@@ -768,7 +769,7 @@ impl Runner<'_> {
768
769
769
770
// Pick a random starting point in the iterator list and rotate the list.
770
771
let n = local_queues. len ( ) ;
771
- let start = fastrand :: usize ( ..n) ;
772
+ let start = rng . usize ( ..n) ;
772
773
let iter = local_queues
773
774
. iter ( )
774
775
. chain ( local_queues. iter ( ) )
You can’t perform that action at this time.
0 commit comments