Locking is the longest-standing poorly understood concept in the ColdFusion development community... it's amazing just exactly how many of us have misperceptions (or even blatantly wrong understandings) of locking, it's purpose, and its correct implementation...
I know I struggle with it... and I've been at this CF stuff for 6 years, and have been programming computers since I was 9 (which means that children born the year I started programming can now buy beer in Minnesota... UGH!) The reason for using named locks to write to application and server variables is actually something I ran headlong into on a project. I used scope locks, and I'm reading/writing to some application-wide variables on a fairly regular basis (I'm using a RAM-based counter routine to track hits and visits), among other things. "Other things" turned out to include just enough that locking the entire application scope effectively hung the app depending on what was going on. When I went back and converted them all to named locks, everything ran fine! Hanging the application scope for everyone using the site really started looking like a bad idea at that point. Think of it this way: using a scope lock on the server scope locks all users, applications, and any other process that uses it out of the server scope. In installations that makes heavy use of it (or an app that uses the application scope heavily, like mine tend to do) that could translate into a LOT of lost time, where using named locks only locks the variables included within it. As far as using scope-locks for sessions... I think that there's a tendency to write to many session-scope variables at once, so scope-locks are convenient. Since management is easier when you're using all scope locks, it may be a matter of simplicity over functionality. Nothing is as simple as "always do it this way" once you've gotten the first few layers beneath the surface,though, so "always use scope locks for..." isn't going to cut it for long. I'm going to continue to handle my locking on a case-by-case basis, using either named or scope-wide locks as appropriate. One thing I can say though, is that I'm terribly glad that read locks, by and large, are a thing of the past. On Wed, 30 Mar 2005 17:44:59 +0100, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > -----Original Message----- > > From: Connie DeCinko [mailto:[EMAIL PROTECTED] > > Sent: 30 March 2005 14:22 > > To: CF-Talk > > Subject: RE: Locking shared scope variables > > > > I thought with CFMX7 we did not need to worry about locks. > > > > > > You don't have to worry about them bringing your server down like the good > old days but you do need to worry about race conditions. In fact I would go > so far to say you only need to worry about race conditions which create > undesirable behavior. > > Kola -- Continuum Media Group LLC Burnsville, MN 55337 http://www.web-relevant.com http://www.web-relevant.com/blogs/cfobjective ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200743 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

