mysterious hang in pthread_create
Andriy Gapon
avg at icyb.net.ua
Mon Sep 1 08:34:54 UTC 2008
on 01/09/2008 11:10 David Xu said the following:
> The ancient bug is in rtld, rlock_acquire() and wlock_acquire() test
> thread_flag as a boolean value, because pt_iterate_phdr() tries to
> lock two locks at same time, this test will always fail once it
> acquired first lock.
>
> The following silly patch fixes the problem Andriy encountered:
I can confirm - this fixed the issue for me.
David, thanks!
> Index: rtld_lock.c
> ===================================================================
> --- rtld_lock.c (版本 182594)
> +++ rtld_lock.c (工作副本)
> @@ -184,7 +184,7 @@
> int
> rlock_acquire(rtld_lock_t lock)
> {
> - if (thread_mask_set(lock->mask)) {
> + if (thread_mask_set(lock->mask) & lock->mask) {
> dbg("rlock_acquire: recursed");
> return (0);
> }
> @@ -195,7 +195,7 @@
> int
> wlock_acquire(rtld_lock_t lock)
> {
> - if (thread_mask_set(lock->mask)) {
> + if (thread_mask_set(lock->mask) & lock->mask) {
> dbg("wlock_acquire: recursed");
> return (0);
> }
>
>
> Regards,
> David Xu
>
--
Andriy Gapon
More information about the freebsd-threads
mailing list