mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-10 00:32:27 +03:00
simplify calling of timer signal handler
This commit is contained in:
parent
06baa2b56c
commit
f01d351842
@ -10,13 +10,12 @@ struct __libc {
|
||||
void (*lock)(volatile int *);
|
||||
void (*lockfile)(FILE *);
|
||||
void (*fork_handler)(int);
|
||||
void (*sigtimer)();
|
||||
int (*rsyscall)(int, long, long, long, long, long, long);
|
||||
int (*atexit)(void (*)(void));
|
||||
void (*fini)(void);
|
||||
void (*ldso_fini)(void);
|
||||
volatile int threads_minus_1;
|
||||
int ofl_lock;
|
||||
int (*rsyscall)(int, long, long, long, long, long, long);
|
||||
FILE *ofl_head;
|
||||
};
|
||||
|
||||
|
@ -4,6 +4,7 @@ static void dummy_1(pthread_t self)
|
||||
{
|
||||
}
|
||||
weak_alias(dummy_1, __pthread_tsd_run_dtors);
|
||||
weak_alias(dummy_1, __sigtimer_handler);
|
||||
|
||||
#ifdef __pthread_unwind_next
|
||||
#undef __pthread_unwind_next
|
||||
@ -47,13 +48,9 @@ static void docancel(struct pthread *self)
|
||||
static void cancel_handler(int sig, siginfo_t *si, void *ctx)
|
||||
{
|
||||
struct pthread *self = __pthread_self();
|
||||
if (!self->cancel) {
|
||||
if (si->si_code == SI_TIMER && libc.sigtimer)
|
||||
libc.sigtimer(sig, si, ctx);
|
||||
return;
|
||||
}
|
||||
if (self->canceldisable) return;
|
||||
if (self->cancelasync || (self->cancelpoint==1 && PC_AT_SYS(ctx)))
|
||||
if (si->si_code == SI_TIMER) __sigtimer_handler(self);
|
||||
if (self->cancel && !self->canceldisable &&
|
||||
(self->cancelasync || (self->cancelpoint==1 && PC_AT_SYS(ctx))))
|
||||
docancel(self);
|
||||
}
|
||||
|
||||
|
@ -13,10 +13,9 @@ struct start_args {
|
||||
struct sigevent *sev;
|
||||
};
|
||||
|
||||
static void sighandler(int sig, siginfo_t *si, void *ctx)
|
||||
void __sigtimer_handler(pthread_t self)
|
||||
{
|
||||
int st;
|
||||
pthread_t self = __pthread_self();
|
||||
void (*notify)(union sigval) = (void (*)(union sigval))self->start;
|
||||
union sigval val = { .sival_ptr = self->start_arg };
|
||||
|
||||
@ -72,7 +71,6 @@ int timer_create(clockid_t clk, struct sigevent *evp, timer_t *res)
|
||||
*res = (void *)(2*timerid+1);
|
||||
break;
|
||||
case SIGEV_THREAD:
|
||||
if (!libc.sigtimer) libc.sigtimer = sighandler;
|
||||
if (sev.sigev_notify_attributes)
|
||||
attr = *sev.sigev_notify_attributes;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user