mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
A new scheduler replaces the old one. - There are no sched_xxx_notify() calls that ask scheduler to change task state. - Tasks now have priorities and different timeslices. - One second interval is distributed among processes. - There are just runnable and expired queues. - SCHED_GRANULARITY determines a maximum running boundary for tasks. - Scheduler can now detect a safe point and suspend a task. Interruptible blocking is implemented. - Mutexes, waitqueues and ipc are modified to have an interruptible nature. - Sleep information is stored on the ktcb. (which waitqueue? etc.)
42 lines
854 B
C
42 lines
854 B
C
#ifndef __LIB_WAIT_H__
|
|
#define __LIB_WAIT_H__
|
|
|
|
#include <l4/lib/list.h>
|
|
#include <l4/lib/spinlock.h>
|
|
|
|
struct ktcb;
|
|
struct waitqueue {
|
|
struct list_head task_list;
|
|
struct ktcb *task;
|
|
};
|
|
|
|
#define CREATE_WAITQUEUE_ON_STACK(wq, tsk) \
|
|
struct waitqueue wq = { \
|
|
.task_list = { &wq.task_list, &wq.task_list }, \
|
|
.task = tsk, \
|
|
};
|
|
|
|
struct waitqueue_head {
|
|
int sleepers;
|
|
struct spinlock slock;
|
|
struct list_head task_list;
|
|
};
|
|
|
|
static inline void waitqueue_head_init(struct waitqueue_head *head)
|
|
{
|
|
memset(head, 0, sizeof(struct waitqueue_head));
|
|
INIT_LIST_HEAD(&head->task_list);
|
|
}
|
|
|
|
void task_set_wqh(struct ktcb *task, struct waitqueue_head *wqh,
|
|
struct waitqueue *wq);
|
|
|
|
void task_unset_wqh(struct ktcb *task);
|
|
|
|
|
|
void wake_up(struct waitqueue_head *wqh, int sync);
|
|
int wake_up_task(struct ktcb *task, int sync);
|
|
|
|
#endif /* __LIB_WAIT_H__ */
|
|
|