Browse Source

Put win32 equivalents of nanosleep and sleep into compat.h fixing sleep() for adl.c.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
07c2ee5317
  1. 2
      adl.c
  2. 11
      compat.h
  3. 10
      miner.h
  4. 1
      util.c

2
adl.c

@ -8,6 +8,7 @@
#include "miner.h" #include "miner.h"
#include "ADL_SDK/adl_sdk.h" #include "ADL_SDK/adl_sdk.h"
#include "compat.h"
#if defined (__linux) #if defined (__linux)
#include <dlfcn.h> #include <dlfcn.h>
@ -16,7 +17,6 @@
#else /* WIN32 */ #else /* WIN32 */
#include <windows.h> #include <windows.h>
#include <tchar.h> #include <tchar.h>
#define sleep(x) Sleep(x)
#endif #endif
#include "adl_functions.h" #include "adl_functions.h"

11
compat.h

@ -2,10 +2,16 @@
#define __COMPAT_H__ #define __COMPAT_H__
#ifdef WIN32 #ifdef WIN32
#include <time.h>
#include <pthread.h>
#include <windows.h> #include <windows.h>
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); Sleep(secs * 1000);
} }
@ -28,6 +34,9 @@ typedef unsigned int uint;
typedef long suseconds_t; typedef long suseconds_t;
#endif #endif
#define PTH(thr) ((thr)->pth.p)
#else
#define PTH(thr) ((thr)->pth)
#endif /* WIN32 */ #endif /* WIN32 */
#endif /* __COMPAT_H__ */ #endif /* __COMPAT_H__ */

10
miner.h

@ -252,16 +252,6 @@ struct cgpu_info {
time_t last_share_pool_time; 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 thread_q {
struct list_head q; struct list_head q;

1
util.c

@ -34,6 +34,7 @@
#endif #endif
#include "miner.h" #include "miner.h"
#include "elist.h" #include "elist.h"
#include "compat.h"
#if JANSSON_MAJOR_VERSION >= 2 #if JANSSON_MAJOR_VERSION >= 2
#define JSON_LOADS(str, err_ptr) json_loads((str), 0, (err_ptr)) #define JSON_LOADS(str, err_ptr) json_loads((str), 0, (err_ptr))

Loading…
Cancel
Save