php3-list | 199903
Date: 03/06/99
- Next message: Sascha Schumann: "Re: [PHP3] SNMP Set ???"
- Previous message: Egon Schmid: "Re: [PHP3] Another thought about GET / POST"
- In reply to: Cameron Just: "Re: [PHP3] .htpasswd"
- Next in thread: Matthew Joseff: "[PHP3] .htpaaswd final (was:Re: [PHP3] .htpasswd)"
- Reply: Matthew Joseff: "[PHP3] .htpaaswd final (was:Re: [PHP3] .htpasswd)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Mar 05, 1999 at 02:31:29PM +1000, Cameron Just wrote:
> Heres some code we just wrote which adds users to a htpasswd file.
>
> 1. Creates a temp file called $htpasswdfile.".lock"
> 2. If this file exists then it waits until doesn't(This stops the
> occurrence of two people adding at once)
And creates a race, until you find a way to do the check and the creation of
the .lock file atomatically.
> The Lock file never gets written to it's just there to let other processes
> know that the htpasswd file is currently being modified.
> This could be done using semaphores but we didn't want to re-learn them
> just yet :)
Using semaphores is a much better way, because it happens to be an atomic
operation.
$semid = sem_get($semaphore_key);
sem_acquire($semid);
...actions...
sem_release($semid);
--Regards,
Sascha Schumann | Consultant | finger sas <email protected> | for PGP public key
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev-list-admin <email protected>
- Next message: Sascha Schumann: "Re: [PHP3] SNMP Set ???"
- Previous message: Egon Schmid: "Re: [PHP3] Another thought about GET / POST"
- In reply to: Cameron Just: "Re: [PHP3] .htpasswd"
- Next in thread: Matthew Joseff: "[PHP3] .htpaaswd final (was:Re: [PHP3] .htpasswd)"
- Reply: Matthew Joseff: "[PHP3] .htpaaswd final (was:Re: [PHP3] .htpasswd)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

