You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Rodney Broom <rb...@home.com> on 2000/09/25 08:56:05 UTC

Re: [OT] flock under win32

Hi all,

Here's my two cents worth (or less):

Teijo Aulin> I got the following error message: "flock() unimplemented on this
platform...
Teijo Aulin> I see that flock() is not implemented under win 98, so how can I
fix this?


Matt Sergeant> It can't ever be locked under Win9x because it doesn't support
the notion of file locking.

Hmm, that can't be altogether true. Haven't we all seen messages from WinDOS
about "cannot access... resource in use"? Although I'd bet that one would have
to use something from the Windoz API to get this functionality. I don't know of
how to do it myself, but maybe something from Dave Roth (www.roth.net).

Matt Sergeant> The only thing you can hope to do is implement some sort of flock
based on writing a temporary file or something.

That's what I'd do. If you were so inclined, you go crazy and write a common
file that kept interesting locking information. Then have your flock() check
that file. The file could even include fancy (unnecessary) stuff like what
process had the resource locked, the lock time, etc. You could go even more nuts
and implement something that watched for shutdown failures to intelligently
removing the locking data file after reboots.

----
Rodney Broom



Re: [OT] flock under win32

Posted by "Alexander Farber (EED)" <ee...@eed.ericsson.se>.
http://www.activestate.com/Products/ActivePerl/docs/lib/Pod/perlport.html#item_flock

    flock FILEHANDLE,OPERATION
         Not implemented (Mac OS, VMS, RISC OS, VOS). 
         Available only on Windows NT (not on Windows 95). (Win32)

and there is also this note in the same document:

    Don't open the same file more than once at a time for writing, 
    as some operating systems put mandatory locks on such files.