|
@@ -1,3 +1,4 @@
|
|
|
|
+#define _GNU_SOURCE
|
|
#include <string.h>
|
|
#include <string.h>
|
|
#include "pthread_impl.h"
|
|
#include "pthread_impl.h"
|
|
#include "syscall.h"
|
|
#include "syscall.h"
|
|
@@ -61,15 +62,15 @@ static void cancel_handler(int sig, siginfo_t *si, void *ctx)
|
|
{
|
|
{
|
|
pthread_t self = __pthread_self();
|
|
pthread_t self = __pthread_self();
|
|
ucontext_t *uc = ctx;
|
|
ucontext_t *uc = ctx;
|
|
- const char *ip = ((char **)&uc->uc_mcontext)[CANCEL_REG_IP];
|
|
|
|
|
|
+ uintptr_t pc = uc->uc_mcontext.MC_PC;
|
|
|
|
|
|
a_barrier();
|
|
a_barrier();
|
|
if (!self->cancel || self->canceldisable == PTHREAD_CANCEL_DISABLE) return;
|
|
if (!self->cancel || self->canceldisable == PTHREAD_CANCEL_DISABLE) return;
|
|
|
|
|
|
_sigaddset(&uc->uc_sigmask, SIGCANCEL);
|
|
_sigaddset(&uc->uc_sigmask, SIGCANCEL);
|
|
|
|
|
|
- if (self->cancelasync || ip >= __cp_begin && ip < __cp_end) {
|
|
|
|
- ((char **)&uc->uc_mcontext)[CANCEL_REG_IP] = (char *)__cp_cancel;
|
|
|
|
|
|
+ if (self->cancelasync || pc >= (uintptr_t)__cp_begin && pc < (uintptr_t)__cp_end) {
|
|
|
|
+ uc->uc_mcontext.MC_PC = (uintptr_t)__cp_cancel;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|