2 Copyright © 2017, The AROS Development Team. All rights reserved.
8 #include <aros/debug.h>
10 #include <proto/exec.h>
12 #include "task_intern.h"
14 void task_CleanList(struct Task
* task
, struct TaskResBase
*TaskResBase
)
16 /* Are there any lock holders?, if not, do housecleaning */
17 if (IsListEmpty(&TaskResBase
->trb_LockedLists
))
19 struct TaskListEntry
*taskEntry
, *tetmp
;
21 #if !defined(__AROSEXEC_SMP__)
22 /* Don't let any other task interfere with us at the moment */
25 EXEC_SPINLOCK_LOCK(&TaskResBase
->TaskListSpinLock
, NULL
, SPINLOCK_MODE_WRITE
);
28 ForeachNodeSafe(&TaskResBase
->trb_TaskList
, taskEntry
, tetmp
)
30 if ((!taskEntry
->tle_Task
) ||
31 ((task
) && (task
== taskEntry
->tle_Task
)))
33 D(bug("[TaskRes] RemTask: destroying old taskentry @ 0x%p\n", taskEntry
));
34 Remove(&taskEntry
->tle_Node
);
35 FreeMem(taskEntry
, sizeof(struct TaskListEntry
));
38 ForeachNodeSafe(&TaskResBase
->trb_NewTasks
, taskEntry
, tetmp
)
40 Remove(&taskEntry
->tle_Node
);
41 AddTail(&TaskResBase
->trb_TaskList
, &taskEntry
->tle_Node
);
44 #if !defined(__AROSEXEC_SMP__)
47 EXEC_SPINLOCK_UNLOCK(&TaskResBase
->TaskListSpinLock
);