Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Aug 2008 17:18:18 +0300
From:      Andriy Gapon <avg@icyb.net.ua>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        davidxu@freebsd.org, freebsd-threads@freebsd.org
Subject:   Re: mysterious hang in pthread_create
Message-ID:  <48B8052A.6070908@icyb.net.ua>
In-Reply-To: <20080829141043.GX2038@deviant.kiev.zoral.com.ua>
References:  <48B70A98.5060501@icyb.net.ua> <48B7101E.7060203@icyb.net.ua> <48B71BA6.5040504@icyb.net.ua> <20080829141043.GX2038@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

Kostik, thanks!

on 29/08/2008 17:10 Kostik Belousov said the following:
> I am wondering why did you not fixed it youself with all this information.

I am wondering that myself now :-)
I got bogged in rtld details and simply didn't think about the solution
of doing setthreaded earlier.

I will try your patch a couple of hours later.
BTW, a forward question - should this patch help in the case of an
exception thrown (and caught) before main(), i.e. in constructors of
static/global objects?

> Anyway, patch below seems to work for me. David may have an opinion on
> the change.
> 
> diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c
> index f96bba9..785d610 100644
> --- a/lib/libthr/thread/thr_init.c
> +++ b/lib/libthr/thread/thr_init.c
> @@ -355,6 +355,9 @@ _libpthread_init(struct pthread *curthread)
>  		if (_thread_event_mask & TD_CREATE)
>  			_thr_report_creation(curthread, curthread);
>  	}
> +
> +	if (_thr_isthreaded() == 0)
> +		_thr_setthreaded(1);
>  }
>  
>  /*


-- 
Andriy Gapon



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