So you're saying lock everything because you don't understand what a race
condition is and how to detect when a variable might be subject to one?

:-)

Sam

-----------------------------------------------
Blog: http://www.rewindlife.com
Charts: http://www.blinex.com/products/charting
-----------------------------------------------

> -----Original Message-----
> From: Calvin Ward [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 28, 2003 1:29 AM
> To: CF-Talk
> Subject: Re: Scope Locking (RE: Blue Dragon and Fusebox)
>
> From the previously referenced page:
> http://www.macromedia.com/support/coldfusion/ts/documents/tn18235.htm
>
> Although it is no longer necessary to worry about your server
> crashing, it is still important to avoid race conditions in
> your application code. Race condition is a term that is not
> specific to ColdFusion programming, but refers to a common
> issue that needs to be taken into consideration when
> programming in any multithreaded environment. Simply put, a
> race condition occurs anytime two threads (in this case, page
> requests) try to write to the same data at the same time. The
> following is an example:
> <cfset session.cartTotal = session.cartTotal + currentPrice>
>
> If two requests to the page that includes this code are made
> at the same time, it is possible that in the time between the
> right-hand side read of the session.cartTotal, and the
> left-hand-side write for the second page request to execute
> and modify session.cartTotal. The result is corrupt data.
> Developers should always ensure that they mitigate or prevent
> corrupt data when writing application code. Using the cflock
> tag in this case will prevent the race condition:
>
> - Calvin
>
>   ----- Original Message -----
>   From: Samuel R. Neff
>   To: CF-Talk
>   Sent: Monday, October 27, 2003 8:56 PM
>   Subject: RE: Scope Locking (RE: Blue Dragon and Fusebox)
>
>   Care to clarify why?  
>
>   > -----Original Message-----
>   > From: Calvin Ward [mailto:[EMAIL PROTECTED]
>   > Sent: Monday, October 27, 2003 1:09 PM
>   > To: CF-Talk
>   > Subject: Re: Scope Locking (RE: Blue Dragon and Fusebox)
>   >
>   > I would opine that locking shared scope variables is still a
>   > best practice and not locking shared scope variables is a bad
>   > practice, regardless of CF version.
>   >
>   > - Calvin
>
>

[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to