28#ifndef MY_THREAD_INCLUDED
29#define MY_THREAD_INCLUDED
43#define ETIME ETIMEDOUT
54#define DEFAULT_THREAD_STACK (1024UL * 1024UL)
65#define MY_THREAD_CREATE_JOINABLE 0
66#define MY_THREAD_CREATE_DETACHED 1
69#define MY_THREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
70#define MY_THREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
71typedef void *(*my_start_routine)(
void *);
76 return GetCurrentThreadId();
78 return pthread_self();
86 return pthread_equal(t1, t2);
92 attr->dwStackSize = 0;
97 return pthread_attr_init(attr);
103 attr->dwStackSize = 0;
108 return pthread_attr_destroy(attr);
115 attr->dwStackSize = (DWORD)stacksize;
118 return pthread_attr_setstacksize(attr, stacksize);
125 attr->detachstate = detachstate;
128 return pthread_attr_setdetachstate(attr, detachstate);
135 *stacksize = (size_t)attr->dwStackSize;
138 return pthread_attr_getstacksize(attr, stacksize);
153 && 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:122
static int is_timeout(int e)
Definition: my_thread.h:56
void my_thread_global_reinit()
Re-initialize components initialized early with my_thread_global_init.
Definition: my_thr_init.cc:116
int my_thread_create(my_thread_handle *thread, const my_thread_attr_t *attr, my_start_routine func, void *arg)
Definition: my_thread.cc:77
int my_thread_join(my_thread_handle *thread, void **value_ptr)
Definition: my_thread.cc:120
void *(* my_start_routine)(void *)
Definition: my_thread.h:71
static int my_thread_attr_getstacksize(my_thread_attr_t *attr, size_t *stacksize)
Definition: my_thread.h:132
#define MY_THREAD_CREATE_JOINABLE
Definition: my_thread.h:69
#define ETIMEDOUT
Definition: my_thread.h:47
int my_thread_cancel(my_thread_handle *thread)
Definition: my_thread.cc:140
bool operator!=(const my_thread_handle &a, const my_thread_handle &b)
Definition: my_thread.h:157
static my_thread_t my_thread_self()
Definition: my_thread.h:74
bool my_thread_init()
Allocate thread specific memory for the thread, used by mysys and dbug.
Definition: my_thr_init.cc:262
void my_thread_global_end()
Definition: my_thr_init.cc:200
static void my_thread_yield()
Definition: my_thread.h:142
#define ETIME
Definition: my_thread.h:43
static int my_thread_attr_destroy(my_thread_attr_t *attr)
Definition: my_thread.h:101
void my_thread_end()
Deallocate memory used by the thread for book-keeping.
Definition: my_thr_init.cc:297
static int my_thread_equal(my_thread_t t1, my_thread_t t2)
Definition: my_thread.h:82
bool operator==(const my_thread_handle &a, const my_thread_handle &b)
Definition: my_thread.h:150
bool my_thread_global_init()
initialize thread environment
Definition: my_thr_init.cc:154
static int my_thread_attr_setstacksize(my_thread_attr_t *attr, size_t stacksize)
Definition: my_thread.h:112
void my_thread_exit(void *value_ptr)
Definition: my_thread.cc:162
static int my_thread_attr_init(my_thread_attr_t *attr)
Definition: my_thread.h:90
void my_thread_self_setname(const char *name)
Sets the name of the thread for system and debugger, if possible.
Definition: my_thread.cc:212
Types to make different thread packages compatible.
pthread_attr_t my_thread_attr_t
Definition: my_thread_bits.h:48
pthread_t my_thread_t
Definition: my_thread_bits.h:47
case opt name
Definition: sslopt-case.h:32
Definition: my_thread_bits.h:51
my_thread_t thread
Definition: my_thread_bits.h:52