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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Mar 17 17:06:39 2015 +0100

cobalt/posix/process: move global thread list out of kqueue container

---

 kernel/cobalt/posix/init.c    |    3 ++-
 kernel/cobalt/posix/process.c |    1 -
 kernel/cobalt/posix/process.h |    3 ++-
 kernel/cobalt/posix/thread.c  |    7 +++----
 kernel/cobalt/posix/thread.h  |    7 ++-----
 5 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/kernel/cobalt/posix/init.c b/kernel/cobalt/posix/init.c
index e97f96f..e955a3f 100644
--- a/kernel/cobalt/posix/init.c
+++ b/kernel/cobalt/posix/init.c
@@ -30,6 +30,8 @@
 #include "monitor.h"
 #include "event.h"
 
+LIST_HEAD(cobalt_thread_list);
+
 struct cobalt_kqueues cobalt_global_kqueues;
 
 void cobalt_cleanup(void)
@@ -49,7 +51,6 @@ int __init cobalt_init(void)
 {
        int ret;
 
-       INIT_LIST_HEAD(&cobalt_global_kqueues.threadq);
        cobalt_time_slice = CONFIG_XENO_OPT_RR_QUANTUM * 1000;
 
        ret = cobalt_process_init();
diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c
index dfcce4c..1ae494f 100644
--- a/kernel/cobalt/posix/process.c
+++ b/kernel/cobalt/posix/process.c
@@ -1323,7 +1323,6 @@ static void *cobalt_process_attach(void)
        INIT_LIST_HEAD(&process->kqueues.condq);
        INIT_LIST_HEAD(&process->kqueues.mutexq);
        INIT_LIST_HEAD(&process->kqueues.semq);
-       INIT_LIST_HEAD(&process->kqueues.threadq);
        INIT_LIST_HEAD(&process->kqueues.monitorq);
        INIT_LIST_HEAD(&process->kqueues.eventq);
        INIT_LIST_HEAD(&process->kqueues.schedq);
diff --git a/kernel/cobalt/posix/process.h b/kernel/cobalt/posix/process.h
index 7f78345..7c9ab2f 100644
--- a/kernel/cobalt/posix/process.h
+++ b/kernel/cobalt/posix/process.h
@@ -38,7 +38,6 @@ struct cobalt_kqueues {
        struct list_head condq;
        struct list_head mutexq;
        struct list_head semq;
-       struct list_head threadq;
        struct list_head monitorq;
        struct list_head eventq;
        struct list_head schedq;
@@ -57,6 +56,8 @@ struct cobalt_process {
        void *priv[NR_PERSONALITIES];
 };
 
+extern struct list_head cobalt_thread_list;
+
 extern struct cobalt_kqueues cobalt_global_kqueues;
 
 int cobalt_register_personality(struct xnthread_personality *personality);
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index cc47c10..c122cf6 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -220,7 +220,7 @@ struct xnthread_personality *cobalt_thread_exit(struct 
xnthread *curr)
        thread_unhash(&thread->hkey);
        xnlock_get_irqsave(&nklock, s);
        cobalt_mark_deleted(thread);
-       list_del(&thread->link);
+       list_del(&thread->next);
        xnlock_put_irqrestore(&nklock, s);
        cobalt_signal_flush(thread);
        xnsynch_destroy(&thread->monitor_synch);
@@ -404,8 +404,7 @@ static int pthread_create(struct cobalt_thread **thread_p,
        }
 
        xnlock_get_irqsave(&nklock, s);
-       thread->container = &cobalt_kqueues(0)->threadq;
-       list_add_tail(&thread->link, thread->container);
+       list_add_tail(&thread->next, &cobalt_thread_list);
        xnlock_put_irqrestore(&nklock, s);
 
        thread->hkey.u_pth = 0;
@@ -424,7 +423,7 @@ static void pthread_discard(struct cobalt_thread *thread)
        xnsynch_destroy(&thread->sigwait);
 
        xnlock_get_irqsave(&nklock, s);
-       list_del(&thread->link);
+       list_del(&thread->next);
        xnlock_put_irqrestore(&nklock, s);
        __xnthread_discard(&thread->threadbase);
        xnfree(thread);
diff --git a/kernel/cobalt/posix/thread.h b/kernel/cobalt/posix/thread.h
index d00879f..ffdf612 100644
--- a/kernel/cobalt/posix/thread.h
+++ b/kernel/cobalt/posix/thread.h
@@ -91,14 +91,11 @@ struct cobalt_thread {
        struct xnthread threadbase;
        struct cobalt_extref extref;
        struct cobalt_process *process;
-
-       /** cobalt_threadq */
-       struct list_head link;
-       struct list_head *container;
+       struct list_head next;  /* in cobalt_thread_list */
 
        /** Signal management. */
        sigset_t sigpending;
-       struct list_head sigqueues[_NSIG]; /* cobalt_sigpending */
+       struct list_head sigqueues[_NSIG]; /* in cobalt_sigpending */
        struct xnsynch sigwait;
        struct list_head signext;
 


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

Reply via email to