summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-08-18 17:14:16 -0400
committerDavid Robillard <d@drobilla.net>2022-08-18 17:14:16 -0400
commit35c7e80281ff6079b6e89dd421addd0a5f6b8b2c (patch)
treec0a6071c8872a79cb4e8670a5845c7b434e557e3
parent4b6cd5239ce102fcb89837195ab47943981a70f5 (diff)
downloadzix-35c7e80281ff6079b6e89dd421addd0a5f6b8b2c.tar.gz
zix-35c7e80281ff6079b6e89dd421addd0a5f6b8b2c.tar.bz2
zix-35c7e80281ff6079b6e89dd421addd0a5f6b8b2c.zip
Fix thread function attributes on Windows
-rw-r--r--include/zix/thread.h5
-rw-r--r--test/test_ring.c6
-rw-r--r--test/test_sem.c6
-rw-r--r--test/test_thread.c3
4 files changed, 7 insertions, 13 deletions
diff --git a/include/zix/thread.h b/include/zix/thread.h
index 29dee44..9c213de 100644
--- a/include/zix/thread.h
+++ b/include/zix/thread.h
@@ -27,7 +27,7 @@ extern "C" {
#ifdef _WIN32
# define ZIX_THREAD_RESULT 0
-# define ZIX_THREAD_FUNC __attribute__((stdcall))
+# define ZIX_THREAD_FUNC __stdcall
typedef HANDLE ZixThread;
typedef DWORD ZixThreadResult;
@@ -51,8 +51,7 @@ typedef void* ZixThreadResult;
"Returning" a result, and communicating with the parent thread in general,
can be done through the pointer argument.
*/
-typedef ZIX_THREAD_FUNC
-ZixThreadResult (*ZixThreadFunc)(void*);
+typedef ZixThreadResult(ZIX_THREAD_FUNC* ZixThreadFunc)(void*);
/**
Initialize `thread` to a new thread.
diff --git a/test/test_ring.c b/test/test_ring.c
index 8016910..7209ac0 100644
--- a/test/test_ring.c
+++ b/test/test_ring.c
@@ -43,8 +43,7 @@ cmp_msg(const int* const msg1, const int* const msg2)
return 1;
}
-ZIX_THREAD_FUNC
-static ZixThreadResult
+static ZixThreadResult ZIX_THREAD_FUNC
reader(void* ZIX_UNUSED(arg))
{
printf("Reader starting\n");
@@ -67,8 +66,7 @@ reader(void* ZIX_UNUSED(arg))
return ZIX_THREAD_RESULT;
}
-ZIX_THREAD_FUNC
-static ZixThreadResult
+static ZixThreadResult ZIX_THREAD_FUNC
writer(void* ZIX_UNUSED(arg))
{
printf("Writer starting\n");
diff --git a/test/test_sem.c b/test/test_sem.c
index 3cda8ea..023b8ee 100644
--- a/test/test_sem.c
+++ b/test/test_sem.c
@@ -14,8 +14,7 @@
static ZixSem sem;
static unsigned n_signals = 1024;
-ZIX_THREAD_FUNC
-static ZixThreadResult
+static ZixThreadResult ZIX_THREAD_FUNC
reader(void* ZIX_UNUSED(arg))
{
printf("Reader starting\n");
@@ -28,8 +27,7 @@ reader(void* ZIX_UNUSED(arg))
return ZIX_THREAD_RESULT;
}
-ZIX_THREAD_FUNC
-static ZixThreadResult
+static ZixThreadResult ZIX_THREAD_FUNC
writer(void* ZIX_UNUSED(arg))
{
printf("Writer starting\n");
diff --git a/test/test_thread.c b/test/test_thread.c
index 6fe80a5..8cfc9f4 100644
--- a/test/test_thread.c
+++ b/test/test_thread.c
@@ -13,8 +13,7 @@ typedef struct {
int output;
} SharedData;
-ZIX_THREAD_FUNC
-static ZixThreadResult
+static ZixThreadResult ZIX_THREAD_FUNC
thread_func(void* const arg)
{
SharedData* const data = (SharedData*)arg;