From 64d74fe8d76c230e61b17482bb098d7f9729141d Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Mon, 25 Jun 2018 21:36:35 +0200 Subject: kern/thread: new thread_cpu function --- kern/thread.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'kern/thread.c') diff --git a/kern/thread.c b/kern/thread.c index 79199a8f..3b6ed3a0 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -2907,6 +2907,15 @@ thread_key_create(unsigned int *keyp, thread_dtor_fn_t dtor) *keyp = key; } +unsigned int +thread_cpu(const struct thread *thread) +{ + const struct thread_runq *runq; + + runq = atomic_load(&thread->runq, ATOMIC_RELAXED); + return runq->cpu; +} + unsigned int thread_state(const struct thread *thread) { -- cgit v1.2.3