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:
@ -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
|
||||
|
Reference in New Issue
Block a user