From b9578c1d8ce54b48363e297b1c56cdea0ed72821 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 13 Mar 2016 15:48:14 +0100 Subject: Removed unnecessary typedefs from thread and spinlock - SPIN_LOCK -> struct spin_lock - rAthread -> struct thread_handle - rAthreadProc -> threadFunc - RATHREAD_PRIO -> enum thread_priority - RAT_PRIO_LOW -> THREADPRIO_LOW - RAT_PRIO_NORMAL -> THREADPRIO_NORMAL - RAT_PRIO_HIGH -> THREADPRIO_HIGH - RA_THREADS_MAX -> THREADS_MAX Signed-off-by: Haru fixupthread --- src/common/thread.h | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/common/thread.h') diff --git a/src/common/thread.h b/src/common/thread.h index be34ea830..bde35f738 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -23,14 +23,15 @@ #include "common/hercules.h" -typedef struct rAthread rAthread; -typedef void* (*rAthreadProc)(void*); - -typedef enum RATHREAD_PRIO { - RAT_PRIO_LOW = 0, - RAT_PRIO_NORMAL, - RAT_PRIO_HIGH -} RATHREAD_PRIO; +/* Opaque Types */ +struct thread_handle; ///< Thread handle. +typedef void *(*threadFunc)(void *); ///< Thread entry point function. + +enum thread_priority { + THREADPRIO_LOW = 0, + THREADPRIO_NORMAL, + THREADPRIO_HIGH +}; struct thread_interface { /** @@ -43,7 +44,7 @@ struct thread_interface { * @return The created thread object. * @retval NULL in vase of failure. */ - rAthread *(*create) (rAthreadProc entryPoint, void *param); + struct thread_handle *(*create) (threadFunc entryPoint, void *param); /** * Creates a new Thread (with more creation options). @@ -57,7 +58,7 @@ struct thread_interface { * @return The created thread object. * @retval NULL in case of failure. */ - rAthread *(*createEx) (rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio); + struct thread_handle *(*createEx) (threadFunc entryPoint, void *param, size_t szStack, enum thread_priority prio); /** * Destroys the given Thread immediately. @@ -67,7 +68,7 @@ struct thread_interface { * * @param handle The thread to destroy. */ - void (*destroy) (rAthread *handle); + void (*destroy) (struct thread_handle *handle); /** * Returns the thread handle of the thread calling this function. @@ -82,7 +83,7 @@ struct thread_interface { * @return the thread handle. * @retval NULL in case of failure. */ - rAthread *(*self) (void); + struct thread_handle *(*self) (void); /** * Returns own thread id (TID). @@ -105,22 +106,22 @@ struct thread_interface { * * @retval true if the given thread has been terminated. */ - bool (*wait) (rAthread *handle, void **out_exitCode); + bool (*wait) (struct thread_handle *handle, void **out_exitCode); /** * Sets the given priority in the OS scheduler. * * @param handle The thread to set the priority for. - * @param prio The priority to set (@see enum RATHREAD_PRIO). + * @param prio The priority to set (@see enum thread_priority). */ - void (*prio_set) (rAthread *handle, RATHREAD_PRIO prio); + void (*prio_set) (struct thread_handle *handle, enum thread_priority prio); /** * Gets the current priority of the given thread. * * @param handle The thread to get the priority for. */ - RATHREAD_PRIO (*prio_get) (rAthread *handle); + enum thread_priority (*prio_get) (struct thread_handle *handle); /** * Tells the OS scheduler to yield the execution of the calling thread. -- cgit v1.2.3-70-g09d2