allow pools to push jobs to any other pool

This commit is contained in:
jacob 2025-07-11 12:06:57 -05:00
parent 25e20ea3bd
commit c1f405c6e4

View File

@ -809,9 +809,10 @@ void sys_run(i32 count, sys_job_func *func, void *sig, enum sys_pool pool_kind,
snc_counter_add(counter, count); snc_counter_add(counter, count);
} }
struct fiber *fiber = fiber_from_id(sys_current_fiber_id()); struct fiber *fiber = fiber_from_id(sys_current_fiber_id());
/* A job cannot create a job with a pool / priority than itself */ priority = clamp_i32(priority, fiber->job_priority, NUM_SYS_PRIORITIES - 1); /* A job cannot create a job with a higher priority than itself */
pool_kind = clamp_i32(pool_kind, fiber->job_pool, NUM_SYS_POOLS - 1); if (pool_kind == SYS_POOL_INHERIT) {
priority = clamp_i32(priority, fiber->job_priority, NUM_SYS_PRIORITIES - 1); pool_kind = fiber->job_pool;
}
struct job_pool *pool = &G.job_pools[pool_kind]; struct job_pool *pool = &G.job_pools[pool_kind];
struct job_queue *queue = &pool->job_queues[priority]; struct job_queue *queue = &pool->job_queues[priority];
tm_lock(&queue->lock); tm_lock(&queue->lock);