I could well be wrong here, but I think maybe people are being misled by the
statement in the MM doc:

"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. "

That doesn't fully describe what's happening in their example

<cfset session.cartTotal = session.cartTotal + currentPrice>

The point about this example is not just that it's writing to a shared scope
variable - it's reading from it and writing to it in one operation. That's
the problem, as I understand it - the reading and writing actions in two
different threads could combine with unpredictable results - hence the need
for locking. I don't think a simple CFSET could cause a problem in MX
because, as someone said, the shared scope structure objects are now
"synchronized" which is Java-speak for single-threaded.

So if you said

<cfset session.cartTotal = 1000000>

for example, that couldn't cause a problem. Except for the shopper's credit
rating.

Maybe?

Nick


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

Reply via email to