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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon May 19 16:01:44 2014 +0200

copperplate/threadobj: fix synchronization protocol in threadobj_cancel()

Over Cobalt, we must kick the canceled thread out of primary mode,
prior to any other operation which might relax the caller, which would
in turn prevent the target thread from receiving the SIGCANCEL
notification indefinitely.

---

 lib/copperplate/threadobj.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index b58bcdb..e6b3992 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -1399,6 +1399,8 @@ static void cancel_sync(struct threadobj *thobj) /* 
thobj->lock held */
        int oldstate, ret = 0;
        sem_t *sem;
 
+       threadobj_cancel_1_corespec(thobj);
+
        /*
         * We have to allocate the cancel sync sema4 in the main heap
         * dynamically, so that it always lives in valid memory when
@@ -1414,7 +1416,6 @@ static void cancel_sync(struct threadobj *thobj) /* 
thobj->lock held */
                __STD(sem_init(sem, sem_scope_attribute, 0));
 
        thobj->cancel_sem = sem;
-       threadobj_cancel_1_corespec(thobj);
 
        /*
         * If the thread to delete is warming up, wait until it


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

Reply via email to