"locks aren't necessary for simple reads" to prevent memory
corruption.  They ARE necessary if you have a potential race
condition.

To put that another way, CF5 and before required locks to prevent
memory corruption, but CF6+ does not.  However, if you care about your
application behaving correctly (not just having non-corrupted memory),
then read-only locks are absolutely needed in certain cases.

Macromedia rather botched up this message, I think, when the change
first happened, because they implied that you no longer had to lock
reads.  In reality, you only get to avoid the lock when you have a
read on a single shared scope variable.  If you have multiple reads,
you must at least consider whether a lock is required (it should be,
but you can sometimes safely skip it).  If you have a read and then a
write, you MUST lock the read.  In this latter case you can do a
read-only lock and then escalate to an exclusive for the write if
that'll reduce the serialization of concurrent requests, but the read
MUST be in a lock.

I don't want to be an anal retentive pedant, but this is REALLY
important.  Doing it wrong will only manifest bugs under weird
situations, so the chance of organically identifying and correcting
the bug is nearly zero.  If you get it wrong, it's going to be a
under-load data corruption issue (not memory corruption, mind you,
data corruption) in production that tells you you have a bug.

cheers,
barneyb

On Mon, May 31, 2010 at 7:52 AM, Raymond Camden <rcam...@gmail.com> wrote:
>
> Do you remember what chapter that is? I'm 99% sure CFWACK makes it
> clear that locks aren't necessary for simple reads. I remember writing
> those updates myself a few revs back but I'd like to confirm the
> current text is clear.
>
>
> On Sun, May 30, 2010 at 4:29 PM, Matthew P. Smith <m...@smithwebdesign.net> 
> wrote:
>>
>> Does this require a lock?
>>
>> I was reading through the CF WACK, and it has an example like so:
>> <cflock name="#application.applicationname#_whatever" type="exclusive"
>> timeout="10">
>>
>> does reading the app scope require a lock?  Would I nest two locks?  Or is
>> it not required because the application name does not change?
>>
>>

-- 
Barney Boisvert
bboisv...@gmail.com
http://www.barneyb.co

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334148
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to