aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbenoit-germain <bnt.germain@gmail.com>2012-04-24 06:24:31 -0700
committerbenoit-germain <bnt.germain@gmail.com>2012-04-24 06:24:31 -0700
commit59e5e111473639c06074e69da6444af14e3f80cd (patch)
treeee8db01b6dc68ed78f6ee884979fff85aade1403 /src
parent60a0e700054f70be151e3765b7ca0878ed379070 (diff)
parent550dd55b0e571577a4ca6ccc880738f1268adb57 (diff)
downloadlanes-59e5e111473639c06074e69da6444af14e3f80cd.tar.gz
lanes-59e5e111473639c06074e69da6444af14e3f80cd.tar.bz2
lanes-59e5e111473639c06074e69da6444af14e3f80cd.zip
Merge pull request #17 from LuaDist/550dd55b0e571577a4ca6ccc880738f1268adb57
merge commits from steve
Diffstat (limited to 'src')
-rw-r--r--src/threading.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/threading.h b/src/threading.h
index 7387764..b0a3db0 100644
--- a/src/threading.h
+++ b/src/threading.h
@@ -32,13 +32,6 @@ typedef int bool_t;
32 32
33typedef unsigned int uint_t; 33typedef unsigned int uint_t;
34 34
35#if defined(PLATFORM_WIN32) && defined(__GNUC__)
36/* MinGW with MSVCR80.DLL */
37/* Do this BEFORE including time.h so that it is declaring _mktime32()
38 * as it would have declared mktime().
39 */
40# define mktime _mktime32
41#endif
42#include <time.h> 35#include <time.h>
43 36
44/* Note: ERROR is a defined entity on Win32 37/* Note: ERROR is a defined entity on Win32
@@ -79,7 +72,7 @@ enum e_status { PENDING, RUNNING, WAITING, DONE, ERROR_ST, CANCELLED };
79 typedef unsigned int THREAD_RETURN_T; 72 typedef unsigned int THREAD_RETURN_T;
80 73
81 #define SIGNAL_T HANDLE 74 #define SIGNAL_T HANDLE
82 75
83 #define YIELD() Sleep(0) 76 #define YIELD() Sleep(0)
84 #define THREAD_CALLCONV __stdcall 77 #define THREAD_CALLCONV __stdcall
85#else // THREADAPI == THREADAPI_PTHREAD 78#else // THREADAPI == THREADAPI_PTHREAD
@@ -110,7 +103,7 @@ enum e_status { PENDING, RUNNING, WAITING, DONE, ERROR_ST, CANCELLED };
110 typedef pthread_cond_t SIGNAL_T; 103 typedef pthread_cond_t SIGNAL_T;
111 104
112 void SIGNAL_ONE( SIGNAL_T *ref ); 105 void SIGNAL_ONE( SIGNAL_T *ref );
113 106
114 // Yield is non-portable: 107 // Yield is non-portable:
115 // 108 //
116 // OS X 10.4.8/9 has pthread_yield_np() 109 // OS X 10.4.8/9 has pthread_yield_np()
@@ -154,7 +147,7 @@ bool_t SIGNAL_WAIT( SIGNAL_T *ref, MUTEX_T *mu, time_d timeout );
154 void THREAD_CREATE( THREAD_T *ref, 147 void THREAD_CREATE( THREAD_T *ref,
155 THREAD_RETURN_T (__stdcall *func)( void * ), 148 THREAD_RETURN_T (__stdcall *func)( void * ),
156 void *data, int prio /* -3..+3 */ ); 149 void *data, int prio /* -3..+3 */ );
157 150
158# define THREAD_PRIO_MIN (-3) 151# define THREAD_PRIO_MIN (-3)
159# define THREAD_PRIO_MAX (+3) 152# define THREAD_PRIO_MAX (+3)
160 153
@@ -174,10 +167,10 @@ bool_t SIGNAL_WAIT( SIGNAL_T *ref, MUTEX_T *mu, time_d timeout );
174 typedef pthread_t THREAD_T; 167 typedef pthread_t THREAD_T;
175# define THREAD_ISNULL( _h) 0 // pthread_t may be a structure: never 'null' by itself 168# define THREAD_ISNULL( _h) 0 // pthread_t may be a structure: never 'null' by itself
176 169
177 void THREAD_CREATE( THREAD_T *ref, 170 void THREAD_CREATE( THREAD_T *ref,
178 THREAD_RETURN_T (*func)( void * ), 171 THREAD_RETURN_T (*func)( void * ),
179 void *data, int prio /* -2..+2 */ ); 172 void *data, int prio /* -2..+2 */ );
180 173
181# if defined(PLATFORM_LINUX) 174# if defined(PLATFORM_LINUX)
182 volatile bool_t sudo; 175 volatile bool_t sudo;
183# ifdef LINUX_SCHED_RR 176# ifdef LINUX_SCHED_RR
@@ -192,7 +185,7 @@ bool_t SIGNAL_WAIT( SIGNAL_T *ref, MUTEX_T *mu, time_d timeout );
192# endif 185# endif
193#endif // THREADAPI == THREADAPI_WINDOWS 186#endif // THREADAPI == THREADAPI_WINDOWS
194 187
195/* 188/*
196* Win32 and PTHREAD_TIMEDJOIN allow waiting for a thread with a timeout. 189* Win32 and PTHREAD_TIMEDJOIN allow waiting for a thread with a timeout.
197* Posix without PTHREAD_TIMEDJOIN needs to use a condition variable approach. 190* Posix without PTHREAD_TIMEDJOIN needs to use a condition variable approach.
198*/ 191*/