diff options
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 |
