Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49487 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82008 invoked from network); 24 Aug 2010 00:35:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Aug 2010 00:35:35 -0000 X-Host-Fingerprint: 99.74.9.184 adsl-99-74-9-184.dsl.ipltin.sbcglobal.net Received: from [99.74.9.184] ([99.74.9.184:6198] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 41/C2-60968-4D3137C4 for ; Mon, 23 Aug 2010 20:35:32 -0400 Message-ID: <41.C2.60968.4D3137C4@pb1.pair.com> To: internals@lists.php.net Date: Mon, 23 Aug 2010 20:35:29 -0400 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2 ThunderBrowse/3.3.1 MIME-Version: 1.0 References: <4C71E705.3000107@gmail.com> In-Reply-To: <4C71E705.3000107@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 99.74.9.184 Subject: Re: Multithreading: I'm not complaining--I did something! (and it workson Windows) From: alecgorge@gmail.com (Alec) As an update, I fixed the crashing bug, the usleep bug (I don't know if it was really a bug, probably just a misinterpretation on my part), and the hanging bug. I fixed thread joining. I updated the samples and I am working on example05.php that will demo cURL! Thanks to Tom R. who contacted me off the mailing list with a patch for the crash that would have taken me forever to track down! -Alec On 8/22/2010 11:12 PM, Alec wrote: > Hi guys, long time reader, 2nd time poster. I realize there is > much...bitterness about multithreading in PHP. I feel it is important, > but I know others don't. I just wanted to write and say that I have made > Moriyoshi Koizumi's php_threading ( > http://github.com/moriyoshi/php-src/blob/PHP_5_3-threading/ext/threading/ ) > available for Windows! > > I converted all of the code to pthreads instead of GNU Pth so that > pthreads-win32 could be used on Windows. I am quite proud to say that > converted it all from Pth to pthreads by only reading the documentation > and never actually building it with GCC--and it worked the first time. > Well, not quite, but those were just dependency and other errors (like > that stupid 32 bit time thing)--all the pthreads stuff worked first time > (that is the first time I have said that about anything C related :D)! I > just converted it all in good ol' Notepad++ and then made VC2008 project. > > > QUICK REPO, SOURCE AND BINARY LOCATION > -------------------------------------- > My repo is at: http://github.com/alecgorge/php_threading > > I push the compiled DLL so you can always find the latest compiled > version at: > http://github.com/alecgorge/php_threading/tree/master/binaries/Release/ > > If you are interested in a "stable" version I will post them at: > http://github.com/alecgorge/php_threading/downloads > > > HELPING > ------- > For those of you interested in helping, go ahead! The repo has > everything you need to build except for the Windows SDK and VC2008. It > has all the PHP headers, PHP libraries, pthreads-win32 headers and > pthreads-win32 libraries you need to compile yourself (in the deps folder). > > Now for the bad part: it is really ****ing buggy. For example: most of > the samples work. Some never exit. Some crash. But overall it is > "stable" enough just to use for a quick personal project with PHP. > > I think the biggest bug is that usleep breaks (whoops). > > > Here is my comments by sample (found in source/samples/) > -------------------------------------------------------- > 01: Works well except for the crashing at the end. > 02: Doesn't work at all. But I have never worked with sockets in PHP so > maybe someone wants to lend a hand? > 03: Goes with example02. Doesn't work at all and I have no clue why. > 04: Demos sending content to threads. It works except it never exits! > > > What I would like: > ------------------ > - Someone with real experience working with threads and C to give me a > hand tracking down some of the bugs. I am willing to fix things myself > but I am having trouble locating things! > > - Linux people to help me out. I have no Linux box handy so tell me if > this build works with Linux. I tried to make sure I didn't break > anything by using conditional comments--and I think it works? (see: > http://github.com/alecgorge/php_threading/blob/master/source/threading.c#L369 > for an example) > > - Linux people to give me build instructions. You can see Moriyoshi's > original instructions at > http://github.com/moriyoshi/php-src/blob/PHP_5_3-threading/ext/threading/README > > > > > Sorry for the wall of text, I just had a very productive 12 hours of > coding and wanted to tell the world :D > > -Alec