From cc889e9d608e6b07b78541849b7e63b6fb3f6058 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sat, 5 Mar 2011 17:48:06 +0000 Subject: Change the thread api a bit. * Remove THREAD_ID_CURRENT macro in favor of a thread_self() function, this allows thread functions to be simpler. * thread_self_entry() shortcut for kernel.c. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29521 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/thread.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'firmware/export/thread.h') diff --git a/firmware/export/thread.h b/firmware/export/thread.h index 0db849ab0a..d0f61f9d85 100644 --- a/firmware/export/thread.h +++ b/firmware/export/thread.h @@ -323,9 +323,6 @@ struct thread_entry #define THREAD_ID_SLOT_MASK 0x00ff #define THREAD_ID_INIT(n) ((1u << THREAD_ID_VERSION_SHIFT) | (n)) -/* Specify current thread in a function taking an ID. */ -#define THREAD_ID_CURRENT ((unsigned int)-1) - #ifdef HAVE_CORELOCK_OBJECT /* Operations to be performed just before stopping a thread and starting a new one if specified before calling switch_thread */ @@ -445,7 +442,13 @@ int thread_get_io_priority(unsigned int thread_id); #if NUM_CORES > 1 unsigned int switch_core(unsigned int new_core); #endif -unsigned int thread_get_current(void); + +/* Return the id of the calling thread. */ +unsigned int thread_self(void); + +/* Return the thread_entry for the calling thread. + * INTERNAL: Intended for use by kernel and not for programs. */ +struct thread_entry* thread_self_entry(void); /* Debugging info - only! */ int thread_stack_usage(const struct thread_entry *thread); -- cgit v1.2.3