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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Nov 29 09:41:45 2011 +0100

copperplate/syncobj,vxworks: fix signature of wait hook

---

 include/copperplate/threadobj.h |    4 ++--
 lib/copperplate/syncobj.c       |    8 ++++----
 lib/copperplate/threadobj.c     |    3 +++
 lib/vxworks/taskLib.c           |    4 ++--
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/include/copperplate/threadobj.h b/include/copperplate/threadobj.h
index 743e302..29de831 100644
--- a/include/copperplate/threadobj.h
+++ b/include/copperplate/threadobj.h
@@ -129,7 +129,7 @@ struct threadobj {
        struct holder wait_link;
        int wait_status;
        int wait_prio;
-       void (*wait_hook)(struct threadobj *thobj, int status);
+       void (*wait_hook)(struct syncobj *sobj, int status);
        void *wait_union;
        size_t wait_size;
 
@@ -146,7 +146,7 @@ struct threadobj_init_data {
        cpu_set_t affinity;
        int priority;
        void (*finalizer)(struct threadobj *thobj);
-       void (*wait_hook)(struct threadobj *thobj, int status);
+       void (*wait_hook)(struct syncobj *sobj, int status);
        void (*suspend_hook)(struct threadobj *thobj, int status);
 };
 
diff --git a/lib/copperplate/syncobj.c b/lib/copperplate/syncobj.c
index 92bc1f4..249e9b2 100644
--- a/lib/copperplate/syncobj.c
+++ b/lib/copperplate/syncobj.c
@@ -228,7 +228,7 @@ int syncobj_pend(struct syncobj *sobj, const struct 
timespec *timeout,
        enqueue_waiter(sobj, current);
 
        if (current->wait_hook)
-               current->wait_hook(current, SYNCOBJ_BLOCK);
+               current->wait_hook(sobj, SYNCOBJ_BLOCK);
 
        /*
         * XXX: we are guaranteed to be in deferred cancel mode, with
@@ -255,7 +255,7 @@ int syncobj_pend(struct syncobj *sobj, const struct 
timespec *timeout,
        pthread_setcancelstate(state, NULL);
 
        if (current->wait_hook)
-               current->wait_hook(current, SYNCOBJ_RESUME);
+               current->wait_hook(sobj, SYNCOBJ_RESUME);
 
        current->wait_sobj = NULL;
 
@@ -344,7 +344,7 @@ int syncobj_wait_drain(struct syncobj *sobj, const struct 
timespec *timeout,
        assert(state == PTHREAD_CANCEL_DISABLE);
 
        if (current->wait_hook)
-               current->wait_hook(current, SYNCOBJ_BLOCK);
+               current->wait_hook(sobj, SYNCOBJ_BLOCK);
 
        if (timeout)
                ret = timedwait_cond(&sobj->post_sync,
@@ -359,7 +359,7 @@ int syncobj_wait_drain(struct syncobj *sobj, const struct 
timespec *timeout,
                list_remove_init(&current->wait_link);
 
        if (current->wait_hook)
-               current->wait_hook(current, SYNCOBJ_RESUME);
+               current->wait_hook(sobj, SYNCOBJ_RESUME);
 
        current->wait_sobj = NULL;
 
diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index c086c80..f4de801 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -989,6 +989,9 @@ int threadobj_unblock(struct threadobj *thobj) /* 
thobj->lock held */
        pthread_t tid = thobj->tid;
        int ret = 0;
 
+       /*
+        * FIXME: racy. We can't assume thobj->wait_sobj is stable.
+        */
        if (thobj->wait_sobj)   /* Remove PEND (+DELAY timeout) */
                syncobj_flush(thobj->wait_sobj, SYNCOBJ_FLUSHED);
        else
diff --git a/lib/vxworks/taskLib.c b/lib/vxworks/taskLib.c
index 4813c4d..e6cdbd5 100644
--- a/lib/vxworks/taskLib.c
+++ b/lib/vxworks/taskLib.c
@@ -146,9 +146,9 @@ static void task_finalizer(struct threadobj *thobj)
  * any thread context, and always runs with the thread lock held
  * for this reason.
  */
-static void task_wait_hook(struct threadobj *thobj, int status)
+static void task_wait_hook(struct syncobj *sobj, int status)
 {
-       struct wind_task *task = container_of(thobj, struct wind_task, thobj);
+       struct wind_task *task = wind_task_current();
 
        if (status & SYNCOBJ_BLOCK)
                task->tcb->status |= WIND_PEND;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to