Module: xenomai-forge
Branch: master
Commit: 7e8527d25660ac6a12078a353ae1429c4c486a08
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=7e8527d25660ac6a12078a353ae1429c4c486a08

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Feb  3 12:00:04 2014 +0100

vxworks/task: fix spurious unlinking upon early deletion

---

 lib/vxworks/taskLib.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/vxworks/taskLib.c b/lib/vxworks/taskLib.c
index 1ef52a5..e3457a3 100644
--- a/lib/vxworks/taskLib.c
+++ b/lib/vxworks/taskLib.c
@@ -151,9 +151,11 @@ static void task_finalizer(struct threadobj *thobj)
 {
        struct wind_task *task = container_of(thobj, struct wind_task, thobj);
 
-       write_lock_nocancel(&wind_task_lock);
-       pvlist_remove(&task->next);
-       write_unlock(&wind_task_lock);
+       if (pvholder_linked(&task->next)) {
+               write_lock_nocancel(&wind_task_lock);
+               pvlist_remove(&task->next);
+               write_unlock(&wind_task_lock);
+       }
 
        task->tcb->status |= WIND_DEAD;
        cluster_delobj(&wind_task_table, &task->cobj);
@@ -356,6 +358,7 @@ static STATUS __taskInit(struct wind_task *task,
        idata.finalizer = task_finalizer;
        idata.priority = cprio;
        threadobj_init(&task->thobj, &idata);
+       initpvh(&task->next);
 
        ret = __bt(cluster_addobj(&wind_task_table, task->name, &task->cobj));
        if (ret) {


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to