mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 15:40:44 +00:00
_thr_sig_check_pending is also called by scope system thread when it leaves
critical region, we wrap some syscalls for thread cancellation point, and when syscalls returns, we call _thr_leave_cancellation_point, at the time if a signal comes in, it would be buffered, and when the thread leaves _thr_leave_cancellation_point, buffered signals will be processed, to avoid messing up normal syscall errno, we should save and restore errno around signal handling code.
This commit is contained in:
parent
c8c57208ce
commit
2d81cd746b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=119177
|
@ -750,10 +750,12 @@ _thr_sig_check_pending(struct pthread *curthread)
|
|||
{
|
||||
ucontext_t uc;
|
||||
volatile int once;
|
||||
int errsave;
|
||||
|
||||
if (THR_IN_CRITICAL(curthread))
|
||||
return;
|
||||
|
||||
errsave = errno;
|
||||
once = 0;
|
||||
THR_GETCONTEXT(&uc);
|
||||
if (once == 0) {
|
||||
|
@ -761,6 +763,7 @@ _thr_sig_check_pending(struct pthread *curthread)
|
|||
curthread->check_pending = 0;
|
||||
_thr_sig_rundown(curthread, &uc, NULL);
|
||||
}
|
||||
errno = errsave;
|
||||
}
|
||||
|
||||
#ifndef SYSTEM_SCOPE_ONLY
|
||||
|
|
|
@ -750,10 +750,12 @@ _thr_sig_check_pending(struct pthread *curthread)
|
|||
{
|
||||
ucontext_t uc;
|
||||
volatile int once;
|
||||
int errsave;
|
||||
|
||||
if (THR_IN_CRITICAL(curthread))
|
||||
return;
|
||||
|
||||
errsave = errno;
|
||||
once = 0;
|
||||
THR_GETCONTEXT(&uc);
|
||||
if (once == 0) {
|
||||
|
@ -761,6 +763,7 @@ _thr_sig_check_pending(struct pthread *curthread)
|
|||
curthread->check_pending = 0;
|
||||
_thr_sig_rundown(curthread, &uc, NULL);
|
||||
}
|
||||
errno = errsave;
|
||||
}
|
||||
|
||||
#ifndef SYSTEM_SCOPE_ONLY
|
||||
|
|
Loading…
Reference in a new issue