--- libaitsched/src/tasks.c 2012/03/13 10:01:59 1.6 +++ libaitsched/src/tasks.c 2012/05/14 12:09:13 1.7 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: tasks.c,v 1.6 2012/03/13 10:01:59 misho Exp $ +* $Id: tasks.c,v 1.7 2012/05/14 12:09:13 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -51,9 +51,9 @@ SUCH DAMAGE. inline sched_task_t * _sched_useTask(sched_root_task_t * __restrict root) { - sched_task_t *task; + sched_task_t *task, *tmp; - TAILQ_FOREACH(task, &root->root_unuse, task_node) { + TAILQ_FOREACH_SAFE(task, &root->root_unuse, task_node, tmp) { if (!TASK_ISLOCKED(task)) { #ifdef HAVE_LIBPTHREAD pthread_mutex_lock(&root->root_mtx[taskUNUSE]);