From 06a85c253005a0b95976dbecae8286a5f6603ba3 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov <0x7fffff@guattari.ru> Date: Thu, 18 Aug 2022 16:41:40 +0400 Subject: Refactor --- source/kit/threads.h | 8 ++------ source/kit/threads.posix.c | 2 +- source/test/unittests/test_duration.test.c | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/kit/threads.h b/source/kit/threads.h index d98978d..584ac7c 100644 --- a/source/kit/threads.h +++ b/source/kit/threads.h @@ -48,11 +48,9 @@ # if defined(_WIN32) && !defined(__CYGWIN__) # include /* close */ # include /* _exit */ -# elif defined(KIT_HAVE_PTHREAD) +# else # include # include /* close, _exit */ -# else -# error Not supported on this platform. # endif /*---------------------------- macros ---------------------------*/ @@ -123,7 +121,7 @@ typedef struct { # define ONCE_FLAG_INIT \ { 0 } # define TSS_DTOR_ITERATIONS 1 -# elif defined(KIT_HAVE_PTHREAD) +# else typedef pthread_cond_t cnd_t; typedef pthread_t thrd_t; typedef pthread_key_t tss_t; @@ -138,8 +136,6 @@ typedef pthread_once_t once_flag; # define TSS_DTOR_ITERATIONS \ 1 // assume TSS dtor MAY be called at least once. # endif -# else -# error Not supported on this platform. # endif /*-------------------- enumeration constants --------------------*/ diff --git a/source/kit/threads.posix.c b/source/kit/threads.posix.c index 20ef1ae..f8c20f9 100644 --- a/source/kit/threads.posix.c +++ b/source/kit/threads.posix.c @@ -30,7 +30,7 @@ * DEALINGS IN THE SOFTWARE. */ #ifndef KIT_DISABLE_SYSTEM_THREADS -# ifdef KIT_HAVE_PTHREAD +# if !defined(_WIN32) || defined(__CYGWIN__) # include # include diff --git a/source/test/unittests/test_duration.test.c b/source/test/unittests/test_duration.test.c index 58faf4a..5d9e578 100644 --- a/source/test/unittests/test_duration.test.c +++ b/source/test/unittests/test_duration.test.c @@ -1,7 +1,7 @@ #define KIT_TEST_FILE test_duration #include "../../kit_test/test.h" -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__CYGWIN__) __declspec(dllimport) void __stdcall Sleep(unsigned long timeout); static void kit_sleep(int ms) { Sleep(ms); -- cgit v1.2.3