Andre,

Java automatically provides it's own internal synchronization to prevent the
variable from being accessed at the exact same time.  Two sets to a variable
will always be sequential, it's just a matter of what's second.

The issue is with a statement like this:

<cfset session.count = session.count + 1>

This is a read and then a write.  You're reading count, adding one to it,
and writing it back.  If after you read the original value someone
incremented the value and you write back your own calculated based on the
original read, you've lost one increment.

This is a race condition.  If it's critical that you have the correct
number, then use cflock to prevent against it.

If the count is not really all that critical, then you can safely ignore,
which is what Ray and Dave said.

If you're counting users, then it's safe to ignore.  If you're working on
back account balances, then you need locking.

Sam

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

> -----Original Message-----
> From: Andre Turrettini [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 28, 2003 8:47 AM
> To: CF-Talk
> Subject: RE: Scope Locking (RE: Blue Dragon and Fusebox)
>
> 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.

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

Reply via email to