[pmwiki-devel] File Locking?

Hans design5 at softflow.co.uk
Tue Oct 30 04:23:30 CDT 2007


Tuesday, October 30, 2007, 6:07:48 AM, Stirling wrote:

> What's the correct way to use PmWiki's Lock() function? I couldn't find any
> documentation on it.

the comment by the function:
## Lock is used to make sure only one instance of PmWiki is running when
## files are being written.  It does not "lock pages" for editing.

PmWiki's Lock() function uses 3 parameters:
Lock(0) Release the lock. (using php LOCK_UN)
Lock(1) Shared lock (reader). (using php LOCK_SH - Allow other processes
    to access the file)
Lock(2) Exclusive lock (writer). (using php LOCK_EX - Prevent other
    processes from accessing the file)

Normally you would use Lock(2) before retrieving the page,
   i.e. with RetrieveAuthPage(),
and Lock(0) after saving the page, i.e. with UpdatePage().

Thanks for bringing this up!
I have now added calls to Lock to Fox's FoxAddEntry function.


Hans




More information about the pmwiki-devel mailing list