Nope, you need a read-only lock around lines 1, 5, and 6 in template
2.  The struct is still an application variable, you're just calling
it with a different name.  If you use duplicate() on line 1, then you
don't need to lock lines 5 and 6.  Obviously you can't write to the
struct if you do that, because it's no longer the same struct, but
that's often the case with application variables.

Note that you only need to lock for race conditions, not for
prevention of memory corruption.  That's a change from CF5 -> CFMX. 
CF takes care of memory issues for you (actually Java does), but for
race condition prevention, CF doesn't do anything to help.

cheers,
barneyb

On Wed, 10 Nov 2004 13:47:08 +0200, Murat Demirci <[EMAIL PROTECTED]> wrote:
> Does cf also lock all variable references of the complex variables of the
> application scope's variables?
> 
> For example:
> 
> Template1.cfm:
> 
> <cflock scope="application" timeout="20" type="exclusive">
>        <cfset application.properties.dsn = "dsn" />
>        <cfset application.properties.locales =structNew() />
> </cflock>
> 
> Template2.cfm:
> Line1: <cfset variables.properties = application.properties />
> Line2: <cfquery datasource="#variables.properties.dsn#">
> Line3:  ....
> Line4: </cfquery>
> Line5: <cfif structKeyExists(variables.properties.locales, url.loc)>
> Line6:    <cfset setLocale(variables.properties.locales[url.loc] />
> Line7: </cfif>
> 
> Template3.cfm:
> <cflock scope="application" timeout="20" type="exclusive">
>        <cfset application.properties.dsn = "anotherdsn" />
>        <cfset application.properties.locales["en_US"] = "English (US)" />
>        <cfset application.properties.locales["en_UK"] = "English (UK)" />
> </cflock>
> 
> Does Cf wait the application lock when using variables.properties in
> template2.cfm?
> Murat.
> 
> 
> 
-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/blog/

I currently have 0 GMail invites for the taking
----------------------------------------------------------
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 
[EMAIL PROTECTED]

Reply via email to