LA.pm: Exlusive write lock

Ask Bjoern Hansen ask at valueclick.com
Sun Jul 1 22:08:49 CDT 2001


On Sun, 1 Jul 2001, Samy Kamkar [CommPort5] wrote:

> Arkadiy Sudarikov wrote:
> >
> > How do I set an exlusive write lock on file? Since they changed
> > www.perl.com, I can't find shit.
>
> use Fnctl ':flock';
> flock(FH, LOCK_EX); # LOCK_EX should be 2 on most systems

or

sysopen(LOCKFILE, $lockfile, O_WRONLY|O_CREAT) or die "can't open $lockfile: $!";
flock(LOCKFILE, LOCK_EX|LOCK_NB) or exit;

if you don't want to block.



 - ask

-- 
ask bjoern hansen, http://ask.netcetera.dk/   !try; do();
more than 100M impressions per day, http://valueclick.com




More information about the Losangeles-pm mailing list