--- libaitsched/src/aitsched.c 2023/02/23 15:41:45 1.30.2.3 +++ libaitsched/src/aitsched.c 2023/02/23 17:13:01 1.30.2.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitsched.c,v 1.30.2.3 2023/02/23 15:41:45 misho Exp $ +* $Id: aitsched.c,v 1.30.2.4 2023/02/23 17:13:01 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -1123,14 +1123,29 @@ schedResumeby(sched_root_task_t * __restrict root, u_c static void * _sched_sigDisp(void *arg) { - sched_root_task_t *sched = arg; - sigset_t ss; - int sig; + sched_root_task_t *root = arg; + sched_task_t *task, *tmp; + int sig, flg; - sigfillset(&ss); - while (sched->root_sigthr) { - sigwait(&ss, &sig); + while (root->root_sigthr) { + if (sigwait(&root->root_sigset, &sig)) + continue; + flg = 0; + TAILQ_FOREACH_SAFE(task, &root->root_signal, task_node, tmp) { + if (TASK_VAL(task) == (uintptr_t) sig) { + if (!flg) { + TASK_RET(task) = 0; + TASK_FLAG(task) = 0; + + /* remove signal handle */ + transit_task2ready(task, &root->root_signal); + } + flg++; + } + } + if (flg < 2) + sigdelset(&root->root_sigset, sig); } return NULL;