aboutsummaryrefslogtreecommitdiff
path: root/src/threading.h
diff options
context:
space:
mode:
authorBenoit Germain <b n t DOT g e r m a i n AT g m a i l DOT c o m>2013-11-29 20:33:46 +0100
committerBenoit Germain <b n t DOT g e r m a i n AT g m a i l DOT c o m>2013-11-29 20:33:46 +0100
commitff74281fc94cda26b2d0a7fc2424f24fe2488718 (patch)
tree6e8aa44d300ccd5da451d02c08cee98090328b60 /src/threading.h
parentb4cd90c9e9a7898775d173df2267d1860dcbc699 (diff)
downloadlanes-ff74281fc94cda26b2d0a7fc2424f24fe2488718.tar.gz
lanes-ff74281fc94cda26b2d0a7fc2424f24fe2488718.tar.bz2
lanes-ff74281fc94cda26b2d0a7fc2424f24fe2488718.zip
supposedly improved pthread support
* bumped version to 3.7.3 * set pthread thread cancel type to PTHREAD_CANCEL_ASYNCHRONOUS * lane_h:cancel() accepts a 3rd timeout argument used when waiting for actual thread termination (hitting the timeout raises an error) * added PROPAGATE_ALLOCF macro to select state creation mode (lua_newstate or luaL_newstate)
Diffstat (limited to 'src/threading.h')
-rw-r--r--src/threading.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/threading.h b/src/threading.h
index aa34248..4b28ce8 100644
--- a/src/threading.h
+++ b/src/threading.h
@@ -194,10 +194,16 @@ bool_t SIGNAL_WAIT( SIGNAL_T *ref, MUTEX_T *mu, time_d timeout );
194# define THREAD_PRIO_MIN (-3) 194# define THREAD_PRIO_MIN (-3)
195# define THREAD_PRIO_MAX (+3) 195# define THREAD_PRIO_MAX (+3)
196 196
197#define THREAD_CLEANUP_PUSH( cb_, val_)
198#define THREAD_CLEANUP_POP( execute_)
199
197#else // THREADAPI == THREADAPI_PTHREAD 200#else // THREADAPI == THREADAPI_PTHREAD
198 /* Platforms that have a timed 'pthread_join()' can get away with a simpler 201 /* Platforms that have a timed 'pthread_join()' can get away with a simpler
199 * implementation. Others will use a condition variable. 202 * implementation. Others will use a condition variable.
200 */ 203 */
204#if defined __WINPTHREADS_VERSION
205#define USE_PTHREAD_TIMEDJOIN
206#endif // __WINPTHREADS_VERSION
201# ifdef USE_PTHREAD_TIMEDJOIN 207# ifdef USE_PTHREAD_TIMEDJOIN
202# ifdef PLATFORM_OSX 208# ifdef PLATFORM_OSX
203# error "No 'pthread_timedjoin()' on this system" 209# error "No 'pthread_timedjoin()' on this system"
@@ -229,6 +235,9 @@ bool_t SIGNAL_WAIT( SIGNAL_T *ref, MUTEX_T *mu, time_d timeout );
229# define THREAD_PRIO_MIN (-2) 235# define THREAD_PRIO_MIN (-2)
230# define THREAD_PRIO_MAX (+2) 236# define THREAD_PRIO_MAX (+2)
231# endif 237# endif
238
239#define THREAD_CLEANUP_PUSH( cb_, val_) pthread_cleanup_push( cb_, val_)
240#define THREAD_CLEANUP_POP( execute_) pthread_cleanup_pop( execute_)
232#endif // THREADAPI == THREADAPI_WINDOWS 241#endif // THREADAPI == THREADAPI_WINDOWS
233 242
234/* 243/*
@@ -253,7 +262,8 @@ bool_t THREAD_WAIT_IMPL( THREAD_T *ref, double secs, SIGNAL_T *signal_ref, MUTEX
253#define THREAD_WAIT THREAD_WAIT_IMPL 262#define THREAD_WAIT THREAD_WAIT_IMPL
254#endif // // THREADWAIT_METHOD == THREADWAIT_CONDVAR 263#endif // // THREADWAIT_METHOD == THREADWAIT_CONDVAR
255 264
256void THREAD_KILL( THREAD_T *ref ); 265void THREAD_KILL( THREAD_T* ref);
257void THREAD_SETNAME( char const* _name); 266void THREAD_SETNAME( char const* _name);
267void THREAD_MAKE_ASYNCH_CANCELLABLE();
258 268
259#endif // __threading_h__ 269#endif // __threading_h__