From 9ff37ba139dceb722af3502816ed228c43fbecfd Mon Sep 17 00:00:00 2001 From: nodist Date: Sun, 1 Nov 2026 15:39:29 -0500 Subject: inc and dec priority with io uring submit --- include/kpl/env.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include/kpl/env.h') diff --git a/include/kpl/env.h b/include/kpl/env.h index 0cab4bc..11f90b3 100644 --- a/include/kpl/env.h +++ b/include/kpl/env.h @@ -76,12 +76,37 @@ typedef enum : uint8_t { KPL_ENV_QUEUE_MODE_SYNC = 1 } kpl_env_queue_mode; +/* + * Increase priority by one + */ +inline void kpl_env_priority_increment(kpl_thread *thread) { + thread->priority++; + thread->env->total_priority++; +} + +/* + * Increase priority by amount + */ +inline void kpl_env_priority_add(kpl_thread *thread, ssize_t amount) { + thread->priority += amount; + thread->env->total_priority += amount; +} + +/* + * Decrease priority by one + */ +inline void kpl_env_priority_decrement(kpl_thread *thread) { + thread->priority--; + thread->env->total_priority--; +} + /* * queue_mode ASYNC queues thread with lowest priority * queue_mode SYNC queues thread on threads[task->thread_id] */ void kpl_env_queue_task(kpl_env *env, kpl_object_task *task, kpl_env_queue_mode queue_mode); + /* * Run once, not re-enetrant * TODO RUN TASK AND IO ORDERING -- cgit v1.2.3