summaryrefslogtreecommitdiff
path: root/include/stdio.h
diff options
context:
space:
mode:
authorJake Mannens <jake72360@gmail.com>2018-08-20 12:44:01 +1000
committerJake Mannens <jake72360@gmail.com>2018-08-20 12:44:01 +1000
commit228de16e2976abb9a15edb41c9b10dbfd309481f (patch)
tree35b7b347d49be2bdb99e534220f3fb152f5c855f /include/stdio.h
parent55c31434991a9c7cb20f7df06e4039fdd8f7152b (diff)
Defined macros cli() and sti() in asm/interrupt.h to disable and enable
interrupts respectively. Added the scheduling primatives sleep_on() and interruptible_sleep_on() to sched.c. sleep_on() adds the current task to the specified wait queue then puts it into an uninterruptible sleep. Wait queues are formed by having each waiting task holding a pointer to the waiting task that preceeded it, then placing a pointer to it's own task struct into the queue's head pointer. When the first task in the queue is awoken, it wakes the preceeding task prior to returning from sleep_on(). The function interruptible_sleep_on() works in a similar manner, however when a task is awoken from interruptible_sleep_on(), it wakes up the first task in it's wait queue, then puts itself back to sleep. The purpose of this, is to automatically dissolve and reform the wait queue. As each task in the queue is a awakened, tasks that need to handle signals will do so whilst tasks that have no pending signals and are still waiting will place themselves back into the wait queue by calling interruptible_sleep_on() again. Whilst this method isn't the most effiecient due to waking every task in a wait queue because one received a signal, it does avoid the mess and complications involved in maintaining the queue as an array or linked list. Added prototypes for the scheduling primatives wake_up(), sleep_on() and interruptible_sleep_on() to kernel/sched.h so that these functions may be used throughout the kernel. Added code to temporaily re-enable interrupts in reschedule() so that the idle loop may continue to function even if interrupts were disabled prior to calling the function.
Diffstat (limited to 'include/stdio.h')
0 files changed, 0 insertions, 0 deletions