Thanks Neil

-----Original Message-----
From: Robertson-Ravo, Neil (RX)
[mailto:[EMAIL PROTECTED]
Sent: 07 September 2006 07:53
To: CF-Talk
Subject: Re: Locking Theory


A race condition is a condition is where a value may be not what you expect
when you get/set it. This is normally the case in say, application, server,
and to a lesser degree session variables.

So, you try and access value a, which you know to be "Jenny" - this is set
at the server level.  Problem is, Ben has went in at the same time to change
this value to "Ben" just as you access it..this is a race condition.

Cflock, ensures that this never happens, as Ben will only ever be able to
chance value a to "Ben" after you have finished with it.

Hth









"This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions." 
Visit our website at http://www.reedexpo.com

-----Original Message-----
From: Jenny Gavin-Wear
To: CF-Talk
Sent: Thu Sep 07 07:43:30 2006
Subject: RE: Locking Theory

Hi Ben,

Could you explain the term "race condition" please?

Jenny

-----Original Message-----
From: Ben Nadel [mailto:[EMAIL PROTECTED]
Sent: 06 September 2006 23:30
To: CF-Talk
Subject: RE: Locking Theory


In my opinion, only use CFLock when you care if the race condition matters.
Take setting SESSION values for instance. Let's say you have the following
code:

<cfset SESSION.FirstName = qUser.first_name />

This would NOT require a lock. Yes, it's shared data. Yes you could have
conflicts. But the question is, does it matter? If a user has two pages that
happen to run this code simultaneously, is there going to be a bad outcome
if no locking? NOOOO. Both will set the appropriate value. 

Then take a session counter in the application:

<cfset APPLICATION.SessionCount = ( APPLICATION.SessionCount + 1 ) />

Again, you are updating shared memory... But again, does it matter? Can this
ever fire in such a way where it will get hurt? No. No matter what, sessions
are going to be added.

So the questions you need to ask yourself in this order are:

1. Is there a race condition?

2. Does the race condition matter?

..........................
Ben Nadel 
www.bennadel.com
Certified Advanced ColdFusion Developer

Need Help?
www.bennadel.com/ask-ben/


-- 

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.1/440 - Release Date: 06/09/2006
 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252328
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to