Re: Bug #13201: pthread_create in extension function never returns

From: Date: Fri, 07 Sep 2001 20:16:23 +0000
Subject: Re: Bug #13201: pthread_create in extension function never returns
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-65383@lists.php.net to get a copy of this message
Have you tried explicitly linking Apache against libpthreads? On 7 Sep 2001 drxor@intellaxiom.com wrote: > From: drxor@intellaxiom.com > Operating system: linux 2.4 glibc 2.1 > PHP version: 4.0.6 > PHP Bug Type: Unknown/Other Function > Bug description: pthread_create in extension function never returns > > I've created a wrapper extension for PHP to include my c++ library in as a > shared module. My c++ library create a thread with pthread_create somewhere > in the code. Using my library inside a stand-alone application works great, > but when using it in PHP extension. The function never returns. > > I compiled PHP with these options > --with-apxs --without-mysql > I hadto disable GetRUsage to be able to compile PHP. > So PHP is an Apache Module. > > I have Pentium 200Mhz with 92MB Linux 2.4.9 with glibc 2.1. > > In fact, only in the main thread (I suppose to be the main thread) the > pthread_create function does not returns. The child thread is create, and > this child can create sub thread and their call to pthread_create > returns. > > The problem can be easily reproduce by adding a pthread_create(&thread_id, > NULL, threadloop, NULL); directly in an extension function. I mean by > extension function the function beginning with PHP_FUNCTION. > > Example: > void* threadloop (void*arg) > { > //This line is execute after pthread_create > } > > PHP_FUNCTION(test) > { > pthread_t othread; > pthread_create (&othread, NULL, threadloop, NULL); > //The execution never comes here > } > > --test.php > > <HTML> > <BODY> > <?php test(); > //Script hang on previous line > ?> > </BODY> > </HTML> > > I would like to know if it's a bug in linux pthread implementation or in > PHP. >

« previous php.dev (#65383) next »