aboutsummaryrefslogtreecommitdiff
path: root/src/threading.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/threading.c')
-rw-r--r--src/threading.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/threading.c b/src/threading.c
index 63c39ae..ad5b473 100644
--- a/src/threading.c
+++ b/src/threading.c
@@ -330,6 +330,8 @@ bool_t THREAD_WAIT_IMPL( THREAD_T *ref, double secs)
330 *ref= NULL; 330 *ref= NULL;
331 } 331 }
332 332
333 void THREAD_MAKE_ASYNCH_CANCELLABLE() {} // nothing to do for windows threads, we can cancel them anytime we want
334
333#if !defined __GNUC__ 335#if !defined __GNUC__
334 //see http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx 336 //see http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
335 #define MS_VC_EXCEPTION 0x406D1388 337 #define MS_VC_EXCEPTION 0x406D1388
@@ -896,11 +898,19 @@ bool_t THREAD_WAIT( THREAD_T *ref, double secs , SIGNAL_T *signal_ref, MUTEX_T *
896#endif // THREADWAIT_METHOD == THREADWAIT_CONDVAR 898#endif // THREADWAIT_METHOD == THREADWAIT_CONDVAR
897 return done; 899 return done;
898 } 900 }
899 // 901 //
900 void THREAD_KILL( THREAD_T *ref ) { 902 void THREAD_KILL( THREAD_T *ref ) {
901 pthread_cancel( *ref ); 903 pthread_cancel( *ref );
902 } 904 }
903 905
906 void THREAD_MAKE_ASYNCH_CANCELLABLE()
907 {
908 // that's the default, but just in case...
909 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
910 // we want cancellation to take effect immediately if possible, instead of waiting for a cancellation point (which is the default)
911 pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
912 }
913
904 void THREAD_SETNAME( char const* _name) 914 void THREAD_SETNAME( char const* _name)
905 { 915 {
906 // exact API to set the thread name is platform-dependant 916 // exact API to set the thread name is platform-dependant