Next File Locking 11

Trap #3: Shutting the Barn Door etc.

Solution 2:

        open S, "> somefile.sem" or die ...;
        flock S, LOCK_EX or die ...;
        open F, "> somefile" or die ...;
        # Now write F
        close F;
        close S;


Next Copyright © 2003 M. J. Dominus