php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13201 pthread_create in extension function never returns
Submitted: 2001-09-07 16:10 UTC Modified: 2001-11-21 18:44 UTC
From: drxor at intellaxiom dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.0.6 OS: linux 2.4 glibc 2.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: drxor at intellaxiom dot com
New email:
PHP Version: OS:

 

 [2001-09-07 16:10 UTC] drxor at intellaxiom dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-21 18:44 UTC] mfischer@php.net
Whatever this is, it does not belong to into the PHP Bug database.

Try on php-general@lists.php.net or php-dev@lists.php.net searching for an answer.

Bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 10:01:31 2024 UTC