tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pthread_getspecific without prior pthread_setspecific



martin%duskware.de@localhost (Martin Husemann) writes:

>Trying to trace down lots of failures of mips N32 userland running on a N64
>kernel, I found that many calls to pthread_getspecific() happen without
>any prior pthread_setspecific().

That's perfectly valid. pthread_getspecific is supposed to return NULL
until the specific data for the key has been set by a call to
pthread_setspecific.


> 	if (__predict_false(__uselibcstub))
> 		return __libc_thr_getspecific_stub(key);
> 
>+	if (!pthread__self()->pt_havespecific)
>+		return NULL;
>+
> 	return pthread__self()->pt_specific[key].pts_value;

>Should I commit the second, or is someone fixing the underlying issue
>and we'll commit the first?

If the issue is that pts_value is not initialized to NULL, then this
won't help. pt_havespecific is set when the first key is set, other
keys might then still be undefined.

But why is this a problem only for mips N32 ?

-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index