diff options
author | Mitya Selivanov <0x7fffff@guattari.ru> | 2022-08-18 16:41:40 +0400 |
---|---|---|
committer | Mitya Selivanov <0x7fffff@guattari.ru> | 2022-08-18 16:41:40 +0400 |
commit | 06a85c253005a0b95976dbecae8286a5f6603ba3 (patch) | |
tree | 2ee2913311d443faa2e5c43bec669b7f9c902835 /source | |
parent | 89686cc730c61227b9874fb4be37c52108ac2c08 (diff) | |
download | kit-06a85c253005a0b95976dbecae8286a5f6603ba3.zip |
Refactor
Diffstat (limited to 'source')
-rw-r--r-- | source/kit/threads.h | 8 | ||||
-rw-r--r-- | source/kit/threads.posix.c | 2 | ||||
-rw-r--r-- | source/test/unittests/test_duration.test.c | 2 |
3 files changed, 4 insertions, 8 deletions
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 <io.h> /* close */ # include <process.h> /* _exit */ -# elif defined(KIT_HAVE_PTHREAD) +# else # include <pthread.h> # include <unistd.h> /* 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 <assert.h> # include <errno.h> 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); |