From 07721b97bfe16e07b986c1378289a4102e71e7dd Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sun, 22 Jan 2012 20:05:18 +0100 Subject: [PATCH] util.h: Include WIN32 compatibility wrappers for sleep() and __sync_fetch_and...() Pointed out by linfk. --- util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/util.h b/util.h index 297a0f9..b815a7d 100644 --- a/util.h +++ b/util.h @@ -3,6 +3,16 @@ #include +/* Portability definitions. */ + +#ifdef _WIN32 +#include + +#define sleep(seconds) Sleep((seconds) * 1000) +#define __sync_fetch_and_add(ap, b) InterlockedExchangeAdd((unsigned long *) (ap), (b)); +#define __sync_fetch_and_sub(ap, b) InterlockedExchangeAdd((unsigned long *) (ap), -(b)); +#endif + /* Misc. definitions. */ /* Use make DOUBLE=1 in large configurations with counts > 1M -- 2.11.4.GIT