From bc07fef09c3df419ac1bc7c7f1e669b51e92569c Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 26 Feb 2013 11:07:28 +0100 Subject: 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. --- src/libstrongswan/threading/thread.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/libstrongswan') diff --git a/src/libstrongswan/threading/thread.c b/src/libstrongswan/threading/thread.c index e524409c7..d6d98d1ef 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 */ -- cgit v1.2.3