2024-02-27 00:30:49 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018,2024 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zephyr/kernel.h>
|
|
|
|
#include <ksched.h>
|
2024-03-07 03:44:22 +08:00
|
|
|
#include <zephyr/sys/math_extras.h>
|
2024-04-11 23:59:07 +08:00
|
|
|
#include <zephyr/sys/dlist.h>
|
2024-02-27 00:30:49 +08:00
|
|
|
|
|
|
|
bool z_priq_rb_lessthan(struct rbnode *a, struct rbnode *b)
|
|
|
|
{
|
|
|
|
struct k_thread *thread_a, *thread_b;
|
|
|
|
int32_t cmp;
|
|
|
|
|
|
|
|
thread_a = CONTAINER_OF(a, struct k_thread, base.qnode_rb);
|
|
|
|
thread_b = CONTAINER_OF(b, struct k_thread, base.qnode_rb);
|
|
|
|
|
|
|
|
cmp = z_sched_prio_cmp(thread_a, thread_b);
|
|
|
|
|
|
|
|
if (cmp > 0) {
|
|
|
|
return true;
|
|
|
|
} else if (cmp < 0) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return thread_a->base.order_key < thread_b->base.order_key
|
|
|
|
? 1 : 0;
|
|
|
|
}
|
|
|
|
}
|