Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Nov 2004 17:12:11 -0500
From:      John Baldwin <jhb@FreeBSD.org>
To:        threads@FreeBSD.org
Subject:   More mono + libpthread breakage..
Message-ID:  <200411021712.11115.jhb@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
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@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411021712.11115.jhb>