From: Tobias Brunner Date: Tue, 26 Feb 2013 10:07:28 +0000 (+0100) Subject: Use SIGUSR2 for SIG_CANCEL on Android X-Git-Tag: 5.0.3dr3~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc07fef09c3df419ac1bc7c7f1e669b51e92569c;p=thirdparty%2Fstrongswan.git Use SIGUSR2 for SIG_CANCEL on Android SIGRTMIN is defined as 32 while sigset_t is defined as unsigned long (i.e. holds 32 signals). Hence, the signal could never be blocked. Sending the signal still canceled threads, but sometimes in situations where they shouldn't have been canceled (e.g. while holding a lock). Fixes #298. --- diff --git a/src/libstrongswan/threading/thread.c b/src/libstrongswan/threading/thread.c index e524409c70..d6d98d1ef3 100644 --- a/src/libstrongswan/threading/thread.c +++ b/src/libstrongswan/threading/thread.c @@ -129,7 +129,11 @@ static thread_value_t *current_thread; #ifndef HAVE_PTHREAD_CANCEL /* if pthread_cancel is not available, we emulate it using a signal */ +#ifdef ANDROID +#define SIG_CANCEL SIGUSR2 +#else #define SIG_CANCEL (SIGRTMIN+7) +#endif /* the signal handler for SIG_CANCEL uses pthread_exit to terminate the * "cancelled" thread */