To ditto what has already been said, but also to clarify:  It is not 
necessary to lock your shared scope access for the purpose of not obtaining 
corrupted reads. i.e. process 1 attempts to read large session variable 
while session 2 is writing to it.  ColdFusion will take care of that for you 
and won't let you read a shared variable that is currently in the process of 
being written.

What is necessary though, is using locks to eliminate race-conditions in 
code.  An example would be where process 1 needs to read from a session 
variable, perform some computations and read/write that variable again and 
it is mandatory that the value of the variable did not change since it was 
first read.  A second process could have modified the contents of the 
session variable after the first process read it but before the second 
process accessed it again.  If you are trying to prevent something like 
that, then you would probably want to use a lock.

Another common idiom where locking is required is when you want to check for 
the existence of a shared variable (session/application/server), and if it 
is not there create it where the creation is a costly operation.  A lock 
would prevent multiple processes from trying to instantiate the shared 
variable all at the same time.

~Brad

----- Original Message ----- 
From: "j s" <[EMAIL PROTECTED]>
To: "cf-talk" <cf-talk@houseoffusion.com>
Sent: Sunday, December 07, 2008 3:12 PM
Subject: locking session variables in cf8


> When creating session structures is it still necessary to cflock in cf8? I 
> think i read somewhere that it was no longer needed but I was probably 
> dreaming.
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316405
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to