mirror of
https://github.com/drasko/codezero.git
synced 2026-01-19 22:33:15 +01:00
exit() almost there.
- Implemented reasonable way to suspend task.
- A task that has a pending suspend would be interrupted
from its sleep via the suspender task.
- If suspend was raised and right after, task became about to sleep,
then scheduler wakes it up.
- If suspend was raised when task was in user mode, then an irq suspends it.
- Also suspends are checked at the end of a syscall so that if suspend was
raised because of a syscall from the task, the task is suspended before it
goes back to user mode.
- This mechanism is very similar to signals, and it may lead as a base for
implementing signal handling.
- Implemented common vma dropping for shadow vm object dropping and task exiting.
This commit is contained in:
@@ -36,8 +36,11 @@ static inline struct ktcb *current_task(void)
|
||||
#define current current_task()
|
||||
#define need_resched (current->ts_need_resched)
|
||||
|
||||
|
||||
void sched_init_task(struct ktcb *task, int priority);
|
||||
void sched_prepare_sleep(void);
|
||||
void sched_suspend_sync(void);
|
||||
void sched_suspend_async(void);
|
||||
void sched_resume_sync(struct ktcb *task);
|
||||
void sched_resume_async(struct ktcb *task);
|
||||
void scheduler_start(void);
|
||||
|
||||
@@ -148,5 +148,7 @@ extern struct id_pool *thread_id_pool;
|
||||
extern struct id_pool *space_id_pool;
|
||||
extern struct id_pool *tgroup_id_pool;
|
||||
|
||||
void task_process_pending_flags(void);
|
||||
|
||||
#endif /* __TCB_H__ */
|
||||
|
||||
|
||||
@@ -10,6 +10,11 @@ struct waitqueue {
|
||||
struct ktcb *task;
|
||||
};
|
||||
|
||||
enum wakeup_flags {
|
||||
WAKEUP_INTERRUPT = (1 << 0),
|
||||
WAKEUP_SYNC = (1 << 1)
|
||||
};
|
||||
|
||||
#define CREATE_WAITQUEUE_ON_STACK(wq, tsk) \
|
||||
struct waitqueue wq = { \
|
||||
.task_list = { &wq.task_list, &wq.task_list }, \
|
||||
@@ -65,9 +70,9 @@ do { \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
void wake_up(struct waitqueue_head *wqh, int sync);
|
||||
int wake_up_task(struct ktcb *task, int sync);
|
||||
void wake_up_all(struct waitqueue_head *wqh, int sync);
|
||||
void wake_up(struct waitqueue_head *wqh, unsigned int flags);
|
||||
int wake_up_task(struct ktcb *task, unsigned int flags);
|
||||
void wake_up_all(struct waitqueue_head *wqh, unsigned int flags);
|
||||
|
||||
#endif /* __LIB_WAIT_H__ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user