File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ exclude = ["/.*"]
1818async-lock = " 2.6"
1919async-task = " 4.0.0"
2020concurrent-queue = " 2.0.0"
21- fastrand = " 1.3.4 "
21+ fastrand = " 2.0.0 "
2222futures-lite = " 1.11.0"
2323slab = " 0.4.4"
2424
Original file line number Diff line number Diff line change @@ -227,12 +227,13 @@ impl<'a> Executor<'a> {
227227 /// ```
228228 pub async fn run < T > ( & self , future : impl Future < Output = T > ) -> T {
229229 let runner = Runner :: new ( self . state ( ) ) ;
230+ let mut rng = fastrand:: Rng :: new ( ) ;
230231
231232 // A future that runs tasks forever.
232233 let run_forever = async {
233234 loop {
234235 for _ in 0 ..200 {
235- let runnable = runner. runnable ( ) . await ;
236+ let runnable = runner. runnable ( & mut rng ) . await ;
236237 runnable. run ( ) ;
237238 }
238239 future:: yield_now ( ) . await ;
@@ -748,7 +749,7 @@ impl Runner<'_> {
748749 }
749750
750751 /// Waits for the next runnable task to run.
751- async fn runnable ( & self ) -> Runnable {
752+ async fn runnable ( & self , rng : & mut fastrand :: Rng ) -> Runnable {
752753 let runnable = self
753754 . ticker
754755 . runnable_with ( || {
@@ -768,7 +769,7 @@ impl Runner<'_> {
768769
769770 // Pick a random starting point in the iterator list and rotate the list.
770771 let n = local_queues. len ( ) ;
771- let start = fastrand :: usize ( ..n) ;
772+ let start = rng . usize ( ..n) ;
772773 let iter = local_queues
773774 . iter ( )
774775 . chain ( local_queues. iter ( ) )
You can’t perform that action at this time.
0 commit comments