Re: Re: sysvsem extention question
| From: | Jason T . Greene | Date: | Fri, 24 Aug 2001 01:47:21 +0000 |
| Subject: | Re: Re: sysvsem extention question | ||
| Groups: | php.dev php.general | ||
| Request: | Send a blank email to php-dev+get-64207@lists.php.net to get a copy of this message | ||
> > Last, i don't see why the implementation as exists, requires 3
> > semaphores.
I just looked over the code, and the reason for this is it specifically designed for a multi-process
web environment. The most common method for semaphore initialization is in the parent process right
before fork. There is no parent initializer for a php module author, and since each child has its
own environment, there is no way to know when to initialize the semaphore.
The way that Tom solved that problem was to create a "USAGE" semaphore which is used to
insure that the semaphore is only initialized once. There must have been some sort of race condition
because the purpose of the 3rd semaphore is a lock.
This is actually a sharp way to handle the problem of no central way to initialize.
-Jason