[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-developers] File Locking



I have tried this routine below and it doesn't give a server error, however
I have no idea if it actually provides a lock. All comments welcome.

sub lock {
        flock("../db/vacs.lck", LOCK_EX);
        # and, in case someone appended
        # while we were waiting...
        seek("../db/vacs.lck", 0, 2);
    }



    sub unlock {
        flock("../db/vacs.lck", LOCK_UN);
    }

&lock;

dbmopen(%db, "../db/vacs", 0666);

&dothings;

dbmclose(%db);
&unlock;

*******

Regards

Peter Stubbs
AgencyCo.com Ltd

Email: mail@xxxxxxxxxxxx

Tel:020 7503 8260
Fax: 0870 056 9199