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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat May  3 10:37:26 2014 +0200

cobalt/posix: drop open coded thread hash lookups

---

 kernel/cobalt/posix/thread.c |   14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index 6365c92..17330c4 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -1083,22 +1083,16 @@ int cobalt_thread_set_name_np(unsigned long pth, const 
char __user *u_name)
 
 int cobalt_thread_probe_np(pid_t pid)
 {
-       struct global_thread_hash *gslot;
-       u32 hash;
-       int ret;
+       struct cobalt_thread *thread;
+       int ret = 0;
        spl_t s;
 
-       hash = jhash2((u32 *)&pid, sizeof(pid) / sizeof(u32), 0);
-
        trace_cobalt_pthread_probe(pid);
 
        xnlock_get_irqsave(&nklock, s);
 
-       gslot = global_index[hash & (PTHREAD_HSLOTS - 1)];
-       while (gslot && gslot->pid != pid)
-               gslot = gslot->next;
-
-       ret = gslot ? 0 : -ESRCH;
+       if (cobalt_thread_find(pid) == NULL)
+               ret = -ESRCH;
 
        xnlock_put_irqrestore(&nklock, s);
 


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

Reply via email to