63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# define of_thread_current pthread_self
#elif defined(_WIN32)
# define of_thread_is_current(t) (t == GetCurrentThread())
# define of_thread_current GetCurrentThread
#endif
static OF_INLINE BOOL
of_thread_new(of_thread_t *thread, id (*main)(id), id data)
{
#if defined(OF_HAVE_PTHREADS)
return !pthread_create(thread, NULL, (void*(*)(void*))main,
(__bridge void*)data);
#elif defined(_WIN32)
*thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)main,
(__bridge void*)data, 0, NULL);
return (thread != NULL);
#endif
}
static OF_INLINE BOOL
|
|
|
|
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# define of_thread_current pthread_self
#elif defined(_WIN32)
# define of_thread_is_current(t) (t == GetCurrentThread())
# define of_thread_current GetCurrentThread
#endif
static OF_INLINE BOOL
of_thread_new(of_thread_t *thread, id (*function)(id), id data)
{
#if defined(OF_HAVE_PTHREADS)
return !pthread_create(thread, NULL, (void*(*)(void*))function,
(__bridge void*)data);
#elif defined(_WIN32)
*thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)function,
(__bridge void*)data, 0, NULL);
return (thread != NULL);
#endif
}
static OF_INLINE BOOL
|