> Ray, i believe what macromedia is refering to is the variable
> being written and overwritten at the same time.  Not a
> variable being written, then overwritten after its set.
>  
> See the note:
> 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.

But what you describe above _is_ a setting of 2 values at _different
times. Not the same time.

> see where it says corrupt data?

Right, but again the point is, is your data corrupt if two different
threads set the value? Look at the example Dave used, and mine. Our
point (if I can speak for Dave ;) is that YOU make the decision if the
data is corrupt or not. If you don't care that the value of X is set
twice because two or more threads hit the code at the same time, then
you don't need to lock.


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

Reply via email to