diff options
author | Haru <haru@dotalux.com> | 2016-03-13 15:48:14 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-07-12 20:58:42 +0200 |
commit | b9578c1d8ce54b48363e297b1c56cdea0ed72821 (patch) | |
tree | 4539010ef6af70a55b2b1515a464ebe3cfe60fcd /src/common/thread.h | |
parent | 8c66f639fdd495f3d28aac905acda823fc6a0ae6 (diff) | |
download | hercules-b9578c1d8ce54b48363e297b1c56cdea0ed72821.tar.gz hercules-b9578c1d8ce54b48363e297b1c56cdea0ed72821.tar.bz2 hercules-b9578c1d8ce54b48363e297b1c56cdea0ed72821.tar.xz hercules-b9578c1d8ce54b48363e297b1c56cdea0ed72821.zip |
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 <haru@dotalux.com>
fixupthread
Diffstat (limited to 'src/common/thread.h')
-rw-r--r-- | src/common/thread.h | 33 |
1 files changed, 17 insertions, 16 deletions
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. |