in reply to Re: Re: unlink & rename in Win32
in thread unlink & rename in Win32

I'm not sure but AFAIK on some OSes you should release locks creates with flock before closing filehandle. That is add
flock(tempfile, 4); flock(logfile, 4);
before closing these filehandles.

P.S. You should avoid using numbers for constants as it is hard to read and is not fail proof. Use symbol names. use Fcntl ':flock' defines for you LOCK_SH, LOCK_EX, LOCK_UN and LOCK_NB constants.

--
Ilya Martynov (http://martynov.org/)

Replies are listed 'Best First'.
Re: Re: Re: Re: unlink & rename in Win32
by rob_au (Abbot) on Dec 02, 2001 at 16:53 UTC
    While I wholeheartedly agree with your comment regarding constant usage and symbol names with flock, the question of releasing locks has been discussed previously here - The summary of this thread was that it wasn't necessary to unlock a file if you were about to close the file as the lock will be released by the closure.

     

    perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'