Skip to content

Commit fe39586

Browse files
committed
separate thread result type from function calling convention (#267)
1 parent 3976830 commit fe39586

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

libde265/threads.cc

+9-7
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
#ifndef _WIN32
3333
// #include <intrin.h>
3434

35-
#define THREAD_RESULT void*
36-
#define THREAD_PARAM void*
35+
#define THREAD_RESULT_TYPE void*
36+
#define THREAD_PARAM_TYPE void*
37+
#define THREAD_CALLING_CONVENTION
3738

3839
#include <stdio.h>
3940

@@ -51,8 +52,9 @@ void de265_cond_wait(de265_cond* c,de265_mutex* m) { pthread_cond_wait(c,m); }
5152
void de265_cond_signal(de265_cond* c) { pthread_cond_signal(c); }
5253
#else // _WIN32
5354

54-
#define THREAD_RESULT DWORD WINAPI
55-
#define THREAD_PARAM LPVOID
55+
#define THREAD_RESULT_TYPE DWORD
56+
#define THREAD_CALLING_CONVENTION WINAPI
57+
#define THREAD_PARAM_TYPE LPVOID
5658

5759
int de265_thread_create(de265_thread* t, LPTHREAD_START_ROUTINE start_routine, void *arg) {
5860
HANDLE handle = CreateThread(NULL, 0, start_routine, arg, 0, NULL);
@@ -184,7 +186,7 @@ void printblks(const thread_pool* pool)
184186
#endif
185187

186188

187-
static THREAD_RESULT worker_thread(THREAD_PARAM pool_ptr)
189+
static THREAD_RESULT_TYPE THREAD_CALLING_CONVENTION worker_thread(THREAD_PARAM_TYPE pool_ptr)
188190
{
189191
thread_pool* pool = (thread_pool*)pool_ptr;
190192

@@ -210,7 +212,7 @@ static THREAD_RESULT worker_thread(THREAD_PARAM pool_ptr)
210212

211213
if (pool->stopped) {
212214
de265_mutex_unlock(&pool->mutex);
213-
return (THREAD_RESULT)0;
215+
return (THREAD_RESULT_TYPE)0;
214216
}
215217

216218

@@ -238,7 +240,7 @@ static THREAD_RESULT worker_thread(THREAD_PARAM pool_ptr)
238240
}
239241
de265_mutex_unlock(&pool->mutex);
240242

241-
return (THREAD_RESULT)0;
243+
return (THREAD_RESULT_TYPE)0;
242244
}
243245

244246

0 commit comments

Comments
 (0)