You are never actually locking the cart, you are locking a block of code or
a scope. Every reference to SESSION variables should be locked. Within a
<CFLOCK> block you can access the SESSION variables as often as needed.

--- Ben


-----Original Message-----
From: Douglas Brown [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 04, 2001 2:09 PM
To: CF-Talk
Subject: Re: Do I need to lock this?


Dave,


Forgive my stupidity, but once I lock the session.cart, I shouldnt have to
lock every reference to it. correct?



Doug


----- Original Message -----
From: "Dave Watts" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, December 04, 2001 10:36 AM
Subject: RE: Do I need to lock this?


> > I was wondering if I need to lock this, I have locking enabled in my
> > application.cfm for sessions?
> >
> > <CFSCRIPT>
> >
> >     if (not(isDefined("session.cart"))){
> >      session.cart = structNew();
>
> I'm not sure what you mean by "hav[ing] locking enabled in ...
> application.cfm for sessions", but the short answer is, yes, you need to
> lock any write to a session variable, unless you've enabled
single-threaded
> sessions in the CF Administrator (which has its own problems, as mentioned
> here last week or so). If you don't have automatic read locking enabled in
> CF Administrator, you'll need to lock all reads as well - which is what I
> recommend. Basically, if you have the word "Session" in your code, I'd
> recommend that you have that in a CFLOCK.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> voice: (202) 797-5496
> fax: (202) 797-5444
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to