> 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 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to