setting a new signal action; this makes sigaction(sig, NULL, &oact)
return a sensible value in the signal mask instead of stack trash.
Addresses PR lib/29536.
XXX the mask seen by signal handlers in a program linked with
libpthread but not yet multithreaded will not reflect masks set here.
After exiting the try-again loop, make one more test of the lock
conditions, in case it was released while a signal handler kept the
thread busy past the alarm expiration.
blockgen!=unblockgen. I'm not sure this is 100% correct, but it partly
alleviates a problem with multiple unblocks for the same thread getting
stacked up.
a timer, as that will clear the timer instead. Pass in a safely in-the-past
value instead.
Addresses PR lib/28700.
(XXX passing in values between 0 and 1000 nanoseconds will still fail, but
that bug needs to be fixed in timer_settime(), not here)
scheduling stuff: only handle SCHED_OTHER. Like the rest of the scheduling
stuff, this is for the benefit of code that can't be bothered to test against
_POSIX_THREAD_PRIORITY_SCHEDULING.
pthread_cond_timedwait().
XXX as noted in the comments, in the situations where these are
useful, they should never be called in a single-threaded
process. Perhaps they should die rather than return 0.
Addresses xsrc/28630.
to be transformed into the do-nothing-when-libpthread-isn't-linked libc
stub names. This will permit library code that uses <pthread.h> and pthread
functions "defensively" to not need to link against libpthread and not need
to be patched to the threadlib.h API.
is set, so that the single-step trap happens in the thread's context
and not in the middle of _setcontext_u.
XXX might be able to do something here with iret, too, but it needs
more testing.
namely, put the thread to deadqueue rather than just leaking it.
- fix a race between pthread_detach/join and pthread_exit,
which also causes dead thread leaks.
waiters list in all cases, not just on cancellation; there are other
sources of spurious wakeups, such as single-stepping in the debugger.
regress/lib/libpthread/conddestroy1 now passes.
- statically initialize all global spin locks. on hppa, 0 means
the lock is held, so leaving them with the default value doesn't work.
- compare functions pointers using a function-pointer type rather than
an integral type. on hppa, function pointers may be indirect,
so we need to trigger gcc to emit calls to the function-pointer
canonicalization routines in the millicode.
- on hppa the stack grows up, so handle that using the STACK_* macros.
sleep(3) expects this, even though it's not a documented property of
nanosleep().
Fixes a problem where sleep() in a threaded program would return
nonzero even on success.
- enable concurrency according to environment variable PTHREAD_CONCURRENCY
- add idle VP wakeup if there are additional jobs and idle VPs
- make reidlequeue per VP
- enable spinning for locks
- fix race condition in alarm processing
- fix race condition in mutex locking
- make debugging output line buffered and add VP prefix to debug lines
- simplify handling of blocked idle threads.
This should fix the ``assertion "target->pt_state != PT_STATE_RUNNING
|| target->pt_blockgen != target->pt_unblockgen" failed'' problem
reported by Marc Recht and Steve Bellovin on current-users.
Also g/c unused pthread__sched_bulk call left over from pthread_sa.c
rev. 1.22 change.
- return EPERM when unlocking a lock which isn't held
=> prevent the failure in PR 24023, where the citrus code had a deadlocking
code path
- remove deadlock check in pthread_rwlock_tryrdlock, return EBUSY instead
=> makes pthread_rwlock_tryrdlock standards compliant
- strong alias __sigprocmask14 to pthread_sigmask
- call _sys___sigprocmask14 where appropriate
- make pthread_sigmask not set the signal mask lazily when pthreads
aren't started yet
- add pt_stackinfo to struct __pthread_st
- add pthread__stackinfo_offset returning the offset from ss_sp to
pt_stackinfo
- pass stackinfo_offset to sa_register and set SA_FLAG_STACKINFO to
make the kernel use it
- call pthread__sa_recycle in pthread__resolve_locks; g/c recycleq and
pthread__recycle_bulk
- return stack in pthread__sa_recycle by incrementing sasi_stackgen
- make pthread__sa_recycle debugging output formatting conditional on
pthread__debug_newline
- add PTHREAD_PID_DEBUG which prints the pid before each debuglog line
- output thread returned in pthread__next
- add asserts in pthread__sched akin to asserts in pthread__sched_bulk:
check if scheduled thread is at front/end of queue
- pthread__upcall: output event/interrupted LWP count instead of LWPid
of the first event/interrupted LWP (since unblock upcalls can have
multiple event LWPs).
- pthread__find_interrupted: output LWPid here
pthread.h pthread_int.h pthread_md.h
Should help prevent the problem I raised in [kern/23946], based on
a hint from Christian Limpach.
Add MAKEVERBOSE support.
with the shell's command to change limits. Make the PTHREAD_STACKSIZE
environment variable override the default stack size. The old fixed
stack size behaviour can be enable with PT_FIXEDSTACKSIZE_LG when building
libpthread.
rename FPBASE to _FPBASE, so that we avoid polluting the user's
name space when e.g. <sys/ptrace.h> is included. Previously, the
PC symbol in mips/regnum.h would conflict with the declaration of
the external variable by the same name in termcap.h, as discovered
by the ``okheaders'' regression test.
[in the context]
- this has the side effect of fixing the problem of the signal mask not
being preserved properly upon signal return, found and fixed by cl.
- add si_code to the tramp debugging output (requested by cl).
cancellation:
* Arrange to not set ptc_mutex until after the pre-sleep cancellation
test.
* In the post-sleep cancellation test, check if there are no more
sleepers and clear ptc_mutex if so.
While here, sprinkle some __predict_false() around the cancellation
tests.
(as it used to be before 1.1.2.12) so that makecontext doesn't stomp
on the data we allocated on the stack. Correct the debugging printf
to print olduc instead of target->pt_uc (we have pt_trapuc now, and
olduc can be pt_trapuc).
handler's stack doesn't stomp siginfo.
this also fixes !__HAVE_SIGINFO, in that case
pthread__signal_tramp assumes uc->uc_stack.ss_sp points the old
signal mask.
pointed by uwe@.
without the blocked/unblocked upcall ordering, an interrupted blocked
upcall might put the blocked thread on the intqueue because it needs
to be continued. With the delayed processing, we avoid putting such a
thread twice on the runqueue.
- fix putting a thread on the intqueue when it needs to be continued
after it blocked.
Also check return value when returning a single stack.
int pthread_attr_setcreatesuspend_np(pthread_attr_t *);
int pthread_suspend_np(pthread_t);
int pthread_resume_np(pthread_t);
needed for java. Approved and fixed by cl.
regular threads can block in the kernel while holding (libpthread) locks
and have to be continued
XXX if the blocked upcall is preempted, the blocked threads syscall
XXX return value can get lost
__cpu_simple_lock_t and __SIMPLELOCK_{UN,}LOCKED from <sys/types.h>.
Should prevent the massive namespace pollution by way of dragging in
many MD headers that has been observed to break stuff.
- prevent BLOCKED upcalls on double page faults and during upcalls
- make libpthread handle blocked threads which hold locks
- prevent UNBLOCKED upcalls from overtaking their BLOCKED upcall
this adds a new syscall sa_unblockyield
see also http://mail-index.netbsd.org/tech-kern/2003/09/15/0020.html
context-to-restore instead of always using pt_uc.
Fixes a problem with signal handlers for synchronous signals noted by
Matthias Drochner on current-users.