29#ifndef MY_THREAD_INCLUDED
30#define MY_THREAD_INCLUDED
44#define ETIME ETIMEDOUT
55#define DEFAULT_THREAD_STACK (1024UL * 1024UL)
66#define MY_THREAD_CREATE_JOINABLE 0
67#define MY_THREAD_CREATE_DETACHED 1
70#define MY_THREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
71#define MY_THREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
72typedef void *(*my_start_routine)(
void *);
77 return GetCurrentThreadId();
79 return pthread_self();
87 return pthread_equal(t1, t2);
93 attr->dwStackSize = 0;
98 return pthread_attr_init(attr);
104 attr->dwStackSize = 0;
109 return pthread_attr_destroy(attr);
116 attr->dwStackSize = (DWORD)stacksize;
119 return pthread_attr_setstacksize(attr, stacksize);
126 attr->detachstate = detachstate;
129 return pthread_attr_setdetachstate(attr, detachstate);
136 *stacksize = (size_t)attr->dwStackSize;
139 return pthread_attr_getstacksize(attr, stacksize);
154 && a.handle == b.handle
Header for compiler-dependent features.
Some integer typedefs for easier portability.
static int my_thread_attr_setdetachstate(my_thread_attr_t *attr, int detachstate)
Definition: my_thread.h:123
static int is_timeout(int e)
Definition: my_thread.h:57
void my_thread_global_reinit()
Re-initialize components initialized early with my_thread_global_init.
Definition: my_thr_init.cc:117
int my_thread_create(my_thread_handle *thread, const my_thread_attr_t *attr, my_start_routine func, void *arg)
Definition: my_thread.cc:78
int my_thread_join(my_thread_handle *thread, void **value_ptr)
Definition: my_thread.cc:121
void *(* my_start_routine)(void *)
Definition: my_thread.h:72
static int my_thread_attr_getstacksize(my_thread_attr_t *attr, size_t *stacksize)
Definition: my_thread.h:133
#define MY_THREAD_CREATE_JOINABLE
Definition: my_thread.h:70
#define ETIMEDOUT
Definition: my_thread.h:48
int my_thread_cancel(my_thread_handle *thread)
Definition: my_thread.cc:141
bool operator!=(const my_thread_handle &a, const my_thread_handle &b)
Definition: my_thread.h:158
static my_thread_t my_thread_self()
Definition: my_thread.h:75
bool my_thread_init()
Allocate thread specific memory for the thread, used by mysys and dbug.
Definition: my_thr_init.cc:263
void my_thread_global_end()
Definition: my_thr_init.cc:201
static void my_thread_yield()
Definition: my_thread.h:143
#define ETIME
Definition: my_thread.h:44
static int my_thread_attr_destroy(my_thread_attr_t *attr)
Definition: my_thread.h:102
void my_thread_end()
Deallocate memory used by the thread for book-keeping.
Definition: my_thr_init.cc:312
static int my_thread_equal(my_thread_t t1, my_thread_t t2)
Definition: my_thread.h:83
bool operator==(const my_thread_handle &a, const my_thread_handle &b)
Definition: my_thread.h:151
bool my_thread_global_init()
initialize thread environment
Definition: my_thr_init.cc:155
static int my_thread_attr_setstacksize(my_thread_attr_t *attr, size_t stacksize)
Definition: my_thread.h:113
void my_thread_exit(void *value_ptr)
Definition: my_thread.cc:163
static int my_thread_attr_init(my_thread_attr_t *attr)
Definition: my_thread.h:91
bool my_thread_is_inited()
Definition: my_thr_init.cc:290
void my_thread_self_setname(const char *name)
Sets the name of the thread for system and debugger, if possible.
Definition: my_thread.cc:213
Types to make different thread packages compatible.
pthread_attr_t my_thread_attr_t
Definition: my_thread_bits.h:49
pthread_t my_thread_t
Definition: my_thread_bits.h:48
case opt name
Definition: sslopt-case.h:29
Definition: my_thread_bits.h:58
my_thread_t thread
Definition: my_thread_bits.h:59