Version 14 of Locking Metakit for CGI

Updated 2003-03-04 18:55:09

Rohan Pall http://rohanpall.com/tclerspub/x.gif

2003-03-03 (March 03, 2003)

The wonderful Metakit database is a very useful tool, and I use it for many of my projects, including Tigerbliss.

I would like to use mk (shortform for Metakit) in harmony with cgi.tcl.

This page documents how to lock the mk db file, so that you don't get multiple processes writing to the same file at the same time -- which will inexorably corrupt your database.

The Wikit package contains the locking code that I'm interested in. I took the acquire and release code from utils.tcl, and the start up code from start.tcl. Thanks go to jcw.

I cleaned up the code, and fixed a bug.

I'm taking the code off the wiki because this morning it looks like some user-agent munged the code.

It will be available at http://rohanpall.com/projects/locktower/

I heartily recommend using Don Libes cgi.tcl, it works great and tastes yummy too.


04mar03 jcw - Thanks for fixing the bug. It explains why lock-breaking always caused the CGI itself to fail, and the next one to work again. Change is also in wikit itself now.


Note that tcllib's ncgi is based on cgi.tcl, but the code has been namespaced.

Ro: Note that this does not make it better. Namespacing packages usually does, but in the case of cgi, where you want to hammer them out quick, the less code, the better. cgi.tcl is tested, time-worn, and made by Don Libes.


Category Internet