Module: xenomai-forge
Branch: next
Commit: 85f43c58a69708556d62103089923425b5e17a91
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=85f43c58a69708556d62103089923425b5e17a91

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat May 11 17:57:14 2013 +0200

alchemy/task: leave cleanup of active threads to the finalizer

---

 lib/alchemy/task.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/lib/alchemy/task.c b/lib/alchemy/task.c
index 1103cb8..e5d1e7d 100644
--- a/lib/alchemy/task.c
+++ b/lib/alchemy/task.c
@@ -44,8 +44,6 @@ static struct alchemy_namegen task_namegen = {
        .length = sizeof ((struct alchemy_task *)0)->name,
 };
 
-static void delete_tcb(struct alchemy_task *tcb);
-
 static struct alchemy_task *find_alchemy_task(RT_TASK *task, int *err_r)
 {
        struct alchemy_task *tcb;
@@ -179,10 +177,8 @@ static void *task_trampoline(void *arg)
        int ret;
 
        ret = task_prologue(tcb);
-       if (ret) {
-               delete_tcb(tcb);
+       if (ret)
                goto out;
-       }
 
        threadobj_notify_entry();
        tcb->entry(tcb->arg);
@@ -194,6 +190,13 @@ out:
        pthread_exit((void *)(long)ret);
 }
 
+static void delete_tcb(struct alchemy_task *tcb)
+{
+       threadobj_destroy(&tcb->thobj);
+       syncobj_uninit(&tcb->sobj_msg);
+       threadobj_free(tcb);
+}
+
 static int create_tcb(struct alchemy_task **tcbp, RT_TASK *task,
                      const char *name, int prio, int mode)
 {
@@ -249,13 +252,6 @@ static int create_tcb(struct alchemy_task **tcbp, RT_TASK 
*task,
        return 0;
 }
 
-static void delete_tcb(struct alchemy_task *tcb)
-{
-       threadobj_destroy(&tcb->thobj);
-       syncobj_uninit(&tcb->sobj_msg);
-       threadobj_free(tcb);
-}
-
 /**
  * @fn int rt_task_create(RT_TASK *task, const char *name, int stksize, int 
prio, int mode)
  * @brief Create a real-time task.


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

Reply via email to