File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,7 +144,10 @@ typedef volatile long atomic_int;
144144#ifndef CLOCK_MONOTONIC
145145#define CLOCK_MONOTONIC 1
146146#endif
147+ #ifndef _TIMESPEC_DEFINED
148+ #define _TIMESPEC_DEFINED
147149struct timespec { long tv_sec; long tv_nsec; };
150+ #endif
148151static inline int clock_gettime(int id, struct timespec* ts) {
149152 (void)id; LARGE_INTEGER f, c;
150153 QueryPerformanceFrequency(&f); QueryPerformanceCounter(&c);
Original file line number Diff line number Diff line change 1818#include <string.h>
1919#include <stdarg.h>
2020#include <stdbool.h>
21+ #if defined(_MSC_VER )
22+ #include <intrin.h>
23+ typedef volatile long atomic_int ;
24+ #define atomic_store (p , v ) _InterlockedExchange((p), (v))
25+ #define atomic_load (p ) _InterlockedCompareExchange((p), 0, 0)
26+ #else
2127#include <stdatomic.h>
28+ #endif
2229#include <signal.h>
2330#include <errno.h>
2431#include <time.h>
32+ #ifdef _WIN32
33+ #include <windows.h>
34+ #define pthread_mutex_t SRWLOCK
35+ #define PTHREAD_MUTEX_INITIALIZER SRWLOCK_INIT
36+ #define pthread_mutex_lock (m ) AcquireSRWLockExclusive(m)
37+ #define pthread_mutex_unlock (m ) ReleaseSRWLockExclusive(m)
38+ #else
2539#include <pthread.h>
40+ #endif
2641#include <unistd.h>
2742#include <sys/socket.h>
2843#include <sys/types.h>
You can’t perform that action at this time.
0 commit comments