[Xenomai-git] Philippe Gerum : cobalt/posix: drop open coded thread hash lookups
Module: xenomai-forge Branch: master Commit: 0db01001c7ca4a6698f71b091a02a07128124be4 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=0db01001c7ca4a6698f71b091a02a07128124be4 Author: Philippe Gerum 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
[Xenomai-git] Philippe Gerum : cobalt/posix: drop open coded thread hash lookups
Module: xenomai-forge Branch: next Commit: 0db01001c7ca4a6698f71b091a02a07128124be4 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=0db01001c7ca4a6698f71b091a02a07128124be4 Author: Philippe Gerum 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
[Xenomai-git] Philippe Gerum : cobalt/posix: drop open coded thread hash lookups
Module: xenomai-forge Branch: next Commit: 5442b222c4fcb5f1d683a0907141a65a2048d1e1 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=5442b222c4fcb5f1d683a0907141a65a2048d1e1 Author: Philippe Gerum 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 e11e777..18939c1 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