Bug #51314 [Opn->Csd]: curl_multi_init example uses to many cpu cycles
| From: | kalle@php.net | Date: | Thu, 18 Mar 2010 15:30:47 +0000 |
| Subject: | Bug #51314 [Opn->Csd]: curl_multi_init example uses to many cpu cycles | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4067@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51314&edit=1
ID: 51314
Updated by: kalle@php.net
Reported by: casper at procurios dot nl
Summary: curl_multi_init example uses to many cpu cycles
-Status: Open
+Status: Closed
Type: Bug
Package: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: kalle
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2010-03-18 16:30:42] kalle@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=296344
Log: Fixed bug #51314 (curl_multi_init example uses to many cpu cycles)
------------------------------------------------------------------------
[2010-03-17 16:06:43] casper at procurios dot nl
Description:
------------
At the curl_multi_init there is an example that says:
$running=null;
//execute the handles
do {
curl_multi_exec($mh,$running);
} while ($running > 0);
This causes a *very* tight loop while curl requests the files, as a
result an
almost 100% cpu usage.
My suggestion is to put a usleep() with a 10ms delay inside the loop:
$running=null;
//execute the handles
do {
usleep(10000);
curl_multi_exec($mh,$running);
} while ($running > 0);
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51314&edit=1