aboutsummaryrefslogtreecommitdiff
path: root/src/threading.h
diff options
context:
space:
mode:
authorBenoit Germain <bnt.germain@gmail.com>2012-09-11 22:23:05 +0200
committerBenoit Germain <bnt.germain@gmail.com>2012-09-11 22:23:05 +0200
commit5fad772d922250db9d46edec156cd89939c4d8b5 (patch)
tree4a0425c4b6a2190dfdfcc64a9af6a04fb2ce0dd3 /src/threading.h
parent8697b3a058f4c58e3a463c77e10cb98fe318f26c (diff)
downloadlanes-5fad772d922250db9d46edec156cd89939c4d8b5.tar.gz
lanes-5fad772d922250db9d46edec156cd89939c4d8b5.tar.bz2
lanes-5fad772d922250db9d46edec156cd89939c4d8b5.zip
code tweaks to enable building against win32-pthread on windows platforms.
not active by default, see threading.h.
Diffstat (limited to '')
-rw-r--r--src/threading.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/threading.h b/src/threading.h
index f4f1ada..b95733d 100644
--- a/src/threading.h
+++ b/src/threading.h
@@ -5,7 +5,10 @@
5#define __threading_h__ 1 5#define __threading_h__ 1
6 6
7/* Platform detection 7/* Platform detection
8*/ 8 * win32-pthread:
9 * define HAVE_WIN32_PTHREAD and PTW32_INCLUDE_WINDOWS_H in your project configuration when building for win32-pthread.
10 * link against pthreadVC2.lib, and of course have pthreadVC2.dll somewhere in your path.
11 */
9#ifdef _WIN32_WCE 12#ifdef _WIN32_WCE
10 #define PLATFORM_POCKETPC 13 #define PLATFORM_POCKETPC
11#elif (defined _WIN32) 14#elif (defined _WIN32)
@@ -44,7 +47,7 @@ enum e_status { PENDING, RUNNING, WAITING, DONE, ERROR_ST, CANCELLED };
44#define THREADAPI_WINDOWS 1 47#define THREADAPI_WINDOWS 1
45#define THREADAPI_PTHREAD 2 48#define THREADAPI_PTHREAD 2
46 49
47#if (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) 50#if( defined( PLATFORM_WIN32) || defined( PLATFORM_POCKETPC)) && !defined( HAVE_WIN32_PTHREAD)
48#define THREADAPI THREADAPI_WINDOWS 51#define THREADAPI THREADAPI_WINDOWS
49#else // (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC) 52#else // (defined PLATFORM_WIN32) || (defined PLATFORM_POCKETPC)
50#define THREADAPI THREADAPI_PTHREAD 53#define THREADAPI THREADAPI_PTHREAD
@@ -114,8 +117,11 @@ enum e_status { PENDING, RUNNING, WAITING, DONE, ERROR_ST, CANCELLED };
114 // FreeBSD 6.2 has pthread_yield() 117 // FreeBSD 6.2 has pthread_yield()
115 // ... 118 // ...
116 // 119 //
117 #ifdef PLATFORM_OSX 120 #if defined( PLATFORM_OSX)
118 #define YIELD() pthread_yield_np() 121 #define YIELD() pthread_yield_np()
122 #elif defined( PLATFORM_WIN32) || defined( PLATFORM_POCKETPC)
123 // for some reason win32-pthread doesn't have pthread_yield(), but sched_yield()
124 #define YIELD() sched_yield()
119 #else 125 #else
120 #define YIELD() pthread_yield() 126 #define YIELD() pthread_yield()
121 #endif 127 #endif