On Tue, Oct 30, 2007 at 02:07:48AM -0400, Stirling Westrup wrote: > What's the correct way to use PmWiki's Lock() function? I couldn't find any > documentation on it. > > I have an application where someone might post a form that creates a blog > entry. The blog group contains blog entries with sequential numerical names. > Once someone hits 'post', the process I have is: > > 1) determine the current highest existing page name in the group. > 2) increment the highest page name to create a new name. > 3) create a new page with that name, and write the information to it. > > Now, if two people are posting entries simultaneously, they may choose to use > the same new page name, and overwrite each other's additions. I would like to > avoid that. Is there some way to use Lock to prevent them stepping on each > other's toes?
At the point where you're determining the current highest existing page name in the group, call Lock(2) . This will prevent any other PmWiki process from updating or saving pages until after the current process has finished (or Lock(0) is called). Pm _______________________________________________ pmwiki-devel mailing list [email protected] http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
