Then your a fool in the making.

Ok, lets say we have 2 threads running.

Thread number one is checking to see if application.flag is true or not, it
sees it as true it gets hafl way through its process the second thread while
running at the same time has now changed this value halfway through the cfif
condition.

That my friend is a typical example of a race condition, dont be fooled as
Ben says lock it.




On 4/15/07, Jochem van Dieten <[EMAIL PROTECTED]> wrote:
>
> Andrew Scott wrote:
> >> <cfset application.flag = true />
> >
> > no on its own that can not cause a race condition, but if somewhere else
> > there is a read on that variable somewhere then that will cause a race
> > condition.
>
> No it doesn't.
>
> The third factor you need is a statement that sets application.flag to
> something else then true.
>
> The fourth factor you need is that your read actually does something
> wrong if it gets a different value then it expected / should get.
>
>
> > So in that scenario if it potentially can cause a race condition then
> lock
> > it, as Ben Forta says.
> >
> > Now as this debate is being discussed because of a CFC inside of a
> session
> > scope, there is an extremely high chance that a race condtion is going
> to
> > occur, so as Ben says lock it.
>
> This debate is in the context of a userbean in the session scope and
> sessions that end prematurely. I would not bother with locking now.
> Sure, in the case of an update to the bean that may give you a one in a
> million chance that on one request you see somebodies old address but
> his new postcode. Big deal. What it does not influence is the chance of
> a premature session end. And since that is an actual, frequently
> occurring problem for OP, the focus should be on solving that problem.
>
> Jochem
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275263
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