[Gc] pthread_cancel(3) confuses ‘GC_suspend_all ()’

Ludovic Courtès ludo at gnu.org
Mon Sep 14 14:57:33 PDT 2009


Hello,

The attached example leads to a deadlock most of the time on a dual-core
‘x86_64-unknown-linux-gnu’ with a recent CVS snapshot of libgc.
Commenting out the pthread_cancel(3) call appears to fix the problem.

When the deadlock occurs, all but one thread are waiting in
sigsuspend(2).  The remaining thread is the one that initiated a
stop-the-world collection; it is waiting on sem_wait(3) from
‘GC_stop_world ()’ because it computed an ‘n_live_threads’ that is
greater than the actual number of other threads.

It looks like there’s a subtle race condition here.  Ideas?

Thanks,
Ludo’.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-csrc
Size: 654 bytes
Desc: not available
Url : http://napali.hpl.hp.com/pipermail/gc/attachments/20090914/5b4c2774/attachment.c


More information about the Gc mailing list