More mono + libpthread breakage..
John Baldwin
jhb at FreeBSD.org
Tue Nov 2 13:11:26 PST 2004
It looks like libpthread is not calling _cond_wait_backout() when a thread
gets a signal after calling thr_sched_switch() from pthread_cond_wait().
Inside of thr_sched_switch_unlocked(), it leaves a critical section and finds
a pending signal, calls thr_sig_defer(). This then calls thr_sig_rundown()
with a psf of NULL. thr_sig_rundown() only checks psf's state to see if it
needs to call _cond_wait_backout(). In libc_r on 4.x at least the state is
always saved into a psf before the equivalent thr_sig_rundown() is called,
i.e. it never has a NULL psf. However, deferred signals from
kse_critical_leave() are never going to back out a mutex queue or condition
variable queue. This kicks in with mono because mono wants to call
'sem_post()' (which is supposed to be signal safe) from a signal handler, but
sem_post() calls pthread_mutex_lock() which dies with an assertion error
about already being on a syncq since _cond_wait_backout() didn't happen.
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the freebsd-threads
mailing list