From 3adf65db3b2e7b3a076b9b017160bb5824cdee71 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sat, 25 Jan 2020 16:41:55 +0900 Subject: [PATCH] Fix some minor problems in the process implementation - Don't lock tasks in process_task_foreach() - Wake up processes when they receive signals --- kernel/core/process.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/core/process.c b/kernel/core/process.c index 9587e28..72ac3e9 100644 --- a/kernel/core/process.c +++ b/kernel/core/process.c @@ -1032,9 +1032,7 @@ int process_task_foreach(process_t *proc, int (*func)(process_t*, task_t*, void* task_t *t = proc->p_tasks[i]; if(t) { - task_lock(t); ret_val = func(proc, t, data); - task_unlock(t); if(ret_val < 0) { break; @@ -1131,6 +1129,8 @@ int process_put_signal(process_t *proc, int signal, siginfo_t *si) ret_val = -EINVAL; if(proc && signal >= 0 && signal <= SIGMAX) { + pid_t pid; + ret_val = -EALREADY; process_lock(proc); @@ -1144,12 +1144,16 @@ int process_put_signal(process_t *proc, int signal, siginfo_t *si) memcpy(&(proc->p_siginfo), si, sizeof(proc->p_siginfo)); } - /* process needs to be woken up if it was sleeping */ - + pid = proc->p_id; ret_val = 0; } process_unlock(proc); + + if(!ret_val) { + /* process needs to be woken up if it was sleeping */ + sched_raise(pid); + } } return(ret_val); -- 2.47.3