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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Apr 22 16:19:22 2014 +0200

cobalt/posix/monitor: drop redundant queuing flag

---

 kernel/cobalt/posix/monitor.c |   10 +++-------
 kernel/cobalt/posix/thread.c  |    1 -
 kernel/cobalt/posix/thread.h  |    1 -
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/kernel/cobalt/posix/monitor.c b/kernel/cobalt/posix/monitor.c
index f1bc84d..c6b982e 100644
--- a/kernel/cobalt/posix/monitor.c
+++ b/kernel/cobalt/posix/monitor.c
@@ -206,8 +206,7 @@ static void cobalt_monitor_wakeup(struct cobalt_monitor 
*mon)
                if (bcast ||
                    (p->u_window->grant_value && p->wchan == 
&thread->monitor_synch)) {
                        xnsynch_wakeup_this_sleeper(&thread->monitor_synch, p);
-                       list_del(&thread->monitor_link);
-                       thread->monitor_queued = 0;
+                       list_del_init(&thread->monitor_link);
                }
        }
 drain:
@@ -277,7 +276,6 @@ int cobalt_monitor_wait(struct cobalt_monitor_shadow __user 
*u_mon,
        else {
                curr->threadbase.u_window->grant_value = 0;
                list_add_tail(&curr->monitor_link, &mon->waiters);
-               curr->monitor_queued = 1;
        }
        datp->flags |= COBALT_MONITOR_PENDED;
 
@@ -291,10 +289,8 @@ int cobalt_monitor_wait(struct cobalt_monitor_shadow 
__user *u_mon,
                }
 
                if ((event & COBALT_MONITOR_WAITDRAIN) == 0 &&
-                   curr->monitor_queued) {
-                       list_del(&curr->monitor_link);
-                       curr->monitor_queued = 0;
-               }
+                   !list_empty(&curr->monitor_link))
+                       list_del_init(&curr->monitor_link);
 
                if (list_empty(&mon->waiters) && !xnsynch_pended_p(&mon->drain))
                        datp->flags &= ~COBALT_MONITOR_PENDED;
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index cd5376b..3ab3879 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -639,7 +639,6 @@ static inline int pthread_create(struct cobalt_thread 
**thread_p,
        thread->sched_u_policy = policy;
        thread->magic = COBALT_THREAD_MAGIC;
        xnsynch_init(&thread->monitor_synch, XNSYNCH_FIFO, NULL);
-       thread->monitor_queued = 0;
 
        xnsynch_init(&thread->sigwait, XNSYNCH_FIFO, NULL);
        sigemptyset(&thread->sigpending);
diff --git a/kernel/cobalt/posix/thread.h b/kernel/cobalt/posix/thread.h
index b1fee6b..b68336e 100644
--- a/kernel/cobalt/posix/thread.h
+++ b/kernel/cobalt/posix/thread.h
@@ -106,7 +106,6 @@ struct cobalt_thread {
        /** Monitor wait object and link holder. */
        struct xnsynch monitor_synch;
        struct list_head monitor_link;
-       int monitor_queued;
 
        struct cobalt_local_hkey hkey;
 };


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

Reply via email to