From 07c2ee5317d4e3c4ab4cd031a4ad3315cc801bb8 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 12 Feb 2012 17:00:44 +1100 Subject: [PATCH] Put win32 equivalents of nanosleep and sleep into compat.h fixing sleep() for adl.c. --- adl.c | 2 +- compat.h | 11 ++++++++++- miner.h | 10 ---------- util.c | 1 + 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/adl.c b/adl.c index d66c7fd9..6c4eb5b4 100644 --- a/adl.c +++ b/adl.c @@ -8,6 +8,7 @@ #include "miner.h" #include "ADL_SDK/adl_sdk.h" +#include "compat.h" #if defined (__linux) #include @@ -16,7 +17,6 @@ #else /* WIN32 */ #include #include -#define sleep(x) Sleep(x) #endif #include "adl_functions.h" diff --git a/compat.h b/compat.h index 245697ab..453c9ae8 100644 --- a/compat.h +++ b/compat.h @@ -2,10 +2,16 @@ #define __COMPAT_H__ #ifdef WIN32 +#include +#include #include -static inline void sleep(int secs) +static inline void nanosleep(struct timespec *rgtp, void *__unused) +{ + Sleep(rgtp->tv_nsec / 1000000); +} +static inline void sleep(unsigned int secs) { Sleep(secs * 1000); } @@ -28,6 +34,9 @@ typedef unsigned int uint; typedef long suseconds_t; #endif +#define PTH(thr) ((thr)->pth.p) +#else +#define PTH(thr) ((thr)->pth) #endif /* WIN32 */ #endif /* __COMPAT_H__ */ diff --git a/miner.h b/miner.h index d9a50a0b..b19a3573 100644 --- a/miner.h +++ b/miner.h @@ -252,16 +252,6 @@ struct cgpu_info { time_t last_share_pool_time; }; -#ifndef WIN32 -#define PTH(thr) ((thr)->pth) -#else -#define PTH(thr) ((thr)->pth.p) -static inline void nanosleep(struct timespec *rgtp, void *__unused) -{ - Sleep(rgtp->tv_nsec / 1000000); -} -#endif - struct thread_q { struct list_head q; diff --git a/util.c b/util.c index cba36ce7..660107bc 100644 --- a/util.c +++ b/util.c @@ -34,6 +34,7 @@ #endif #include "miner.h" #include "elist.h" +#include "compat.h" #if JANSSON_MAJOR_VERSION >= 2 #define JSON_LOADS(str, err_ptr) json_loads((str), 0, (err_ptr))