[204] in Pthreads mailing list archive
Re: Checking pthread allocation in pthread_create.
daemon@ATHENA.MIT.EDU (Christopher Provenzano)
Thu Nov 16 07:27:49 1995
To: Yann Langlais <ylanglais@houston.geoquest.slb.com>
Cc: pthreads@MIT.EDU
In-Reply-To: Your message of "Mon, 13 Nov 1995 15:06:07 CST."
<199511132106.PAA02379@phoenix.gdm.houston.geoquest.slb.com>
Date: Thu, 16 Nov 1995 06:38:23 EST
From: Christopher Provenzano <proven@MIT.EDU>
>
>
> Hi,
>
> I installed pthreads-1_60_beta4_1 on SunOS 4.1.3, using gcc2.7.0.
> After a stupid trial of passing non allocated pthread_t variable to
> pthread_create, I had an infinite loop while running a veray simple
> test. Using gdb, it appeard that a segmentation fault occured in
> pthread_create() line 193 of the file ./pthreads/pthread.c while
> trying to assign the new thread structure to the user one:
>
> 193 (*thread) = new_thread;
>
> Wouldn't it be possible to test the assignment of the thread
> variable at the very beginning of the pthread_create() function???
>
> Ok, this is not an issue, but it assumes that the user is intelligent
> and will not make something stupid, which is far from being my case;-)
Actually there is a bug here. The assignement (line 193) should be moved
outside of the locked pthread kernel (past line 195) for precisely this reason.
The signal should be handelable by the current thread which it can't do
if the current thread has the pthread kernel locked.
CAP