But Ray, in the example you used, you are clearly NOT sure that your
variable will only be written to once. Right?
So if you did:
<cfif not isDefined( 'application.dsn' )>
<cfset application.dsn = "foo"/>
</cfif>
Then you would not need to lock it. 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?
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Raymond Camden
> Sent: Wednesday, December 03, 2003 4:34 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] Basic CFC Design Question
>
>
>
> > Basically, it seems to come down to this: if you are storing
> > a value in a shared-memory scope, and you are positive that
> > it will only be written to once, then you don't need to lock
> > reads or writes to this variable.
> > If there is any chance that it could be written to more than
> > once, then you must lock the write with an exclusive lock and
> > lock reads with a readonly lock. It's not enough to only
> > lock the write because you could still end up with a
> > situation where an unlocked read happens while the variable
> > is being written to. Is that in the ballpark?
>
> Not true. Consider:
>
> <cfset application.dsn = "foo">
>
> While it may waste 0.001 ms to run this twice, it's ok to run
> it twice (or N
> times)
>
>
> ==============================================================
> =============
> 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]
----------------------------------------------------------
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]