in reply to Multiprocess logging mechanism

I'm not sure I understood, but if I did what you want is actually to unlock:
use Fcntl ':flock'; #... flock(FH,LOCK_UN); #Or: flock(FH,8);

Replies are listed 'Best First'.
Re: Re: Multiprocess logging mechanism
by rob_au (Abbot) on Feb 26, 2002 at 11:31 UTC
    While locks of files can be removed and the file handle held open between writes, this should not be done unless you also remember to resynchronise the file handle when you subsequently reacquire a lock on the file handle. Eg.

    flock (FH, LOCK_EX); # acquire exclusive lock seek (FH, 1, 0); # resynchronise the file buffer

    Failure to resynchronise the file handle can cause many problems where multiple processes are accessing and updating the file handle simultaneously - This aspect of file locking was discussed in detail in this thread.

     

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