diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-11-01 15:39:29 -0500 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-11-01 15:39:29 -0500 |
| commit | 9ff37ba139dceb722af3502816ed228c43fbecfd (patch) | |
| tree | 7bca7bf7a98858a9f4bad4b3d8f0d3febf50fe4c /include/kpl/env.h | |
| parent | 9a61168aec3373be702bdbf252043ce3605f2b5b (diff) | |
inc and dec priority with io uring submit
Diffstat (limited to 'include/kpl/env.h')
| -rw-r--r-- | include/kpl/env.h | 25 |
1 files changed, 25 insertions, 0 deletions
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 @@ -77,11 +77,36 @@ typedef enum : uint8_t { } 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 |
