<cflock type="readonly">
<cfset reload = NOT structKeyExists(application, "foo") />
</cflock>
<cfif reload>
<cflock type="exclusive">
<cfif NOT structKeyExists(application, "foo")>
<cfset application.foo = createObject("component", "foo") />
<cfset application.foo.init() />
</cfif>
</cflock>
</cfif>
That code is not thread safe either (for exactly the same reason). Thread 1 can get as far as creating foo but not initializing it and then thread 2 can run off and try to use the uninitialized foo object...
Regards, Sean
----------------------------------------------------------
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]
