Cleaned up the use of thread types

The THREAD type was not used everywhere and pthread_t was used instead.
The thread creation function also returned the address of a stack allocated
value which isn't guaranteed to be usable.
This commit is contained in:
Markus Makela
2016-01-23 02:56:04 +02:00
parent da1a717dd8
commit 0111df3767
13 changed files with 79 additions and 43 deletions

View File

@ -17,22 +17,25 @@
*
* Copyright MariaDB Corporation Ab 2013-2014
*/
#include <pthread.h>
/**
* @file thread.h The gateway threading interface
*
* An encapsulation of the threading used by the gateway. This is designed to
* isolate the majority of the gateway code from th epthread library, enabling
* isolate the majority of the gateway code from the pthread library, enabling
* the gateway to be ported to a different threading package with the minimum
* of changes.
*/
#define THREAD pthread_t
#define THREAD_SHELF pthread_self
/**
* Thread type and thread identifier function macros
*/
#include <pthread.h>
#define THREAD pthread_t
#define thread_self() pthread_self()
extern void *thread_start(void (*entry)(void *), void *arg);
extern void thread_wait(void *thd);
extern THREAD *thread_start(THREAD *thd, void (*entry)(void *), void *arg);
extern void thread_wait(THREAD thd);
extern void thread_millisleep(int ms);
#endif