Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27247 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44836 invoked by uid 1010); 3 Jan 2007 08:44:03 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 44821 invoked from network); 3 Jan 2007 08:44:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2007 08:44:03 -0000 X-Host-Fingerprint: 83.238.26.17 centrum2.piekary.net Received: from [83.238.26.17] ([83.238.26.17:7391] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9F/0A-13873-3DC6B954 for ; Wed, 03 Jan 2007 03:44:03 -0500 Message-ID: <9F.0A.13873.3DC6B954@pb1.pair.com> To: internals@lists.php.net References: <20070102122940.662ebd49.mba2000@ioplex.com><3E.25.03249.EBCAA954@pb1.pair.com><20070102143627.0c0e6985.mba2000@ioplex.com><6A.C8.03249.FD6FA954@pb1.pair.com><20070102210641.06af4197.mba2000@ioplex.com> <20070103013718.2810799f.mba2000@ioplex.com> Date: Wed, 3 Jan 2007 09:43:55 +0100 Lines: 24 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Original X-Posted-By: 83.238.26.17 Subject: Re: [PHP-DEV] Semaphores - feature request From: wojtekm86@konto.pl ("Wojciech Malota") > You must use some additional application specific logic to trigger > semaphore removal. For example you could have a "boss" process that > collects the exit status of each "worker". When the boss process has an > exit status for all workers the semaphore can be removed. > > Am I getting closer or am I still not understanding the problem? > > Mike You are much closer now. I think that PHP interpreter should be a "boss" because PHP scripts don't know if this execution of website is the last which releases the semaphore. So if last script calls my_sem_release function, the semaphore will be removed and now another script calls my_sem_acquire function it won't cause an error because inside my_sem_acquire function is called sem_get() which will create this semaphore once again. So this solution is completely safe. I haven't got knowledge about PHP source code, so I can't implement this behaviour - I give only an idea. The key to success is that all instructions in functions my_sem_acquire and my_sem_release can't be interrupted. Wojciech Malota