38 void *(*routine)(
void *p);
45 unsigned int __stdcall win32_routine(
void *p)
48 void *userdata = t->
data;
49 t->
data = t->routine(userdata);
59 int r = pthread_create(&t->id, 0, start_routine, arg);
71 t->routine = start_routine;
72 ex_ret = _beginthreadex(NULL, 0, win32_routine, t, 0, &threadID);
78 t->handle = (HANDLE) ex_ret;
80 t->
data = start_routine(arg);
90 #ifdef YAZ_POSIX_THREADS
91 pthread_join((*tp)->id, value_ptr);
94 WaitForSingleObject((*tp)->handle, INFINITE);
95 CloseHandle((*tp)->handle);
98 *value_ptr = (*tp)->data;
109 #ifdef YAZ_POSIX_THREADS
110 pthread_detach((*tp)->id);
113 CloseHandle((*tp)->handle);
Header for errno utilities.
void yaz_thread_detach(yaz_thread_t *tp)
detach thread
yaz_thread_t yaz_thread_create(void *(*start_routine)(void *p), void *arg)
create thread
void yaz_thread_join(yaz_thread_t *tp, void **value_ptr)
join thread
Implements thread creation wrappers.
struct yaz_thread * yaz_thread_t
Thread Identifier opaque pointer.
Header for memory handling functions.
#define xfree(x)
utility macro which calls xfree_f
#define xmalloc(x)
utility macro which calls malloc_f