]> gitweb.factorcode.org Git - factor.git/blob - basis/unix/scheduler/linux/linux.factor
Switch to https urls
[factor.git] / basis / unix / scheduler / linux / linux.factor
1 ! Copyright (C) 2022 Cat Stevens.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: alien.c-types alien.syntax kernel sequences ;
4 IN: unix.scheduler
5
6 ! Note: Feature "_POSIX_PRIORITY_SCHEDULING"
7 ! Scheduling policy values from <sched.h>
8 CONSTANT: SCHED_OTHER 0
9 CONSTANT: SCHED_FIFO  1
10 CONSTANT: SCHED_RR    2
11
12 ! Note: Feature "__USE_GNU"
13 CONSTANT: SCHED_BATCH    3
14 CONSTANT: SCHED_ISO      4
15 CONSTANT: SCHED_IDLE     5
16 CONSTANT: SCHED_DEADLINE 6
17
18 CONSTANT: SCHED_RESET_ON_FORK 0x40000000
19 ! end __USE_GNU
20
21 CONSTANT: MOST_IDLE_SCHED_POLICY 5
22
23 FUNCTION: int sched_get_priority_min ( int policy )
24 FUNCTION: int sched_get_priority_max ( int policy )
25
26 : policy-priority-range ( policy -- high low )
27     [ sched_get_priority_max ] [ sched_get_priority_min ] bi ;
28
29 : priority-allowed? ( policy -- ? )
30     { SCHED_IDLE SCHED_OTHER SCHED_BATCH } member? not ;