> But Ray, in the example you used, you are clearly NOT sure 
> that your variable will only be written to once.  Right?

No. Again, it is a waste of time to set application.dsn more than once,
however, it's is a very trivial waste of time.

> So if you did:
> <cfif not isDefined( 'application.dsn' )>
>       <cfset application.dsn = "foo"/>
> </cfif>
> 
> Then you would not need to lock it.  

That is not what you said though. The code above CAN be run twice, because
two (or more) threads can read the isDefined line and both see false. Again
though, its not a big deal.


>But doing it the way you 
> show, with no check for it's presence before writing to it, 
> you would need to lock it, and then lock all reads to it as 
> well.  Correct?

No. Again, assuming MX, it doesn't matter if N threads read the value while
its being set if it is static.

===========================================================================
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)

Email    : [EMAIL PROTECTED]
Blog     : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to