]> git.lizzy.rs Git - rust.git/commitdiff
kmc-solid: Wait queue should be sorted in the descending order of task priorities
authorTomoaki Kawada <kawada@kmckk.co.jp>
Thu, 10 Feb 2022 02:26:46 +0000 (11:26 +0900)
committerTomoaki Kawada <kawada@kmckk.co.jp>
Thu, 10 Feb 2022 02:35:37 +0000 (11:35 +0900)
In ITRON, lower priority values mean higher priorities.

library/std/src/sys/itron/condvar.rs

index 84b0f4c866ab2b1453ca6d82126d54c36b67ac14..2992a6a542901ccd5fc0d521368344bdbc8fd437 100644 (file)
@@ -192,7 +192,7 @@ pub unsafe fn insert(&mut self, mut waiter_ptr: NonNull<Waiter>) {
                     let insert_after = {
                         let mut cursor = head.last;
                         loop {
-                            if waiter.priority <= cursor.as_ref().priority {
+                            if waiter.priority >= cursor.as_ref().priority {
                                 // `cursor` and all previous waiters have the same or higher
                                 // priority than `current_task_priority`. Insert the new
                                 // waiter right after `cursor`.