On Wed, 3 Jan 2007 06:51:57 +0100
"Wojciech Malota" <[EMAIL PROTECTED]> wrote:

> > How would your code decide when to actually go ahead and remove the
> > semaphore?
> >
> > Are you suggesting that the semaphore simply be removed whenever it
> > is determined to be "unlocked"? Meaning you want to call semget() and
> > semctl(IPC_RMID) for every single lock/unlock?
> 
> I've wrote about it in my first letter.
> There are two functions: my_sem_acquire and my_sem_release.

Well I read your original post again. Clearly I've been off track.

So the problem is that one process may call semop AFTER another process
calls semctl(IPC_RMID) to remove the semaphore from the system?

If that's the case then it is still impossible to know if it's ok to
remove a semaphore. Only the application would know when all paticipants
will no longer need the semaphore and that it can be safely removed. I'm
not familiar with the PHP semaphore API but I know a lot about the
SysV semphore C api and there's no "FIFO" that could be used to somehow
indicate that it's safe to remove a semaphore.

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

-- 
Michael B Allen
PHP Active Directory SSO
http://www.ioplex.com/

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

Reply via email to