Jeff .. you wrote .. >On May 15, King, Jason said: > >>>A rather clever way to emulate locking is to use mkdir() and rmdir(). >>> >>>Although it requires you to create a lock file, it's atomic and safe. >> >>are you sure ? .. just because it constitutes one Perl >statement doesn't >>mean that it's atomic .. I suspect mkdir has several steps internally >> >>if you're sure then can you please provide references to the >atomicity of >>mkdir .. because it's a great find if it's truly atomic - >many peopl believe >>there to be no atomic file locking operation on Win9x machines > >Here are some references: > >http://www.davin.ottawa.on.ca/archive/modperl/2000-09/msg00683.phtml >http://mail-index.netbsd.org/tech-security/1997/03/24/0010.html >http://mail.gnu.org/pipermail/info-cvs/2000-December/011597.html none of those references deal with whether mkdir on Win32 is atomic or not .. certainly I agree that it's atomic under BSD and GNU based systems .. but the only mention of Win32 in those references leaves the hanging question "Of course, then the question is... is mkdir() atomic on Win32 Perl.." >They say that mkdir() is atomic ON A SERVER -- if you're on an NFS, all >bets are off. > >The Perl Cookbook mentions the mkdir+rmdir locking scheme. I >think that's a pretty safe bet. actually .. the references (and specifically the Cookbook example) are talking specifically about locking over NFS (where flock often does not work) .. hence the name of the Cookbook section "Program: netlock" but nothing conclusively answers the question about Win32 mkdir .. and even more damning .. nothing mentions the Win(Me|98|95) flavours of Win32 where flock is not atomic and therefore I would hazard a guess that mkdir is non atomic (especially with the whole long-filename issue) on Win32 the mkdir() function is implemented with a call to _wmkdir .. you'd have to show me some references to this function and whether it was an atomic operation before I'd trust it on Win32 -- jason king In South Carolina, merchandise may not be sold within a half mile of a church unless fruit is being sold. - http://dumblaws.com/