--=====================_3589612==_.ALT
Content-Type: text/plain; charset="us-ascii"

He did not contradict himself or anyone else in this thread at all.
You must lock Application variables when reading or writing. If you only locked when 
writing, the reads would run without even checking if there was a write lock at that 
moment.

One frequently encountered exception is when you define an Application variable ONLY 
ONCE at the beginning of the application (usually in Application.cfm)  like this:

<CFIF NOT IsDefined("Application.GlobalVar")>
        ...lock it & set it once and never again...
</CFIF>

The reason this is an exception is because you KNOW ahead of time as the programmer 
that there is ZERO chance of the code trying to read and write the variable at the 
same time because you will NEVER write it again after that one first CFSET that will 
run the first time the first page is loaded.

Oh, and if what I just said it correct I must finally understand how this works! :-)


At 03:45 PM 7/28/00 -0400, Mike Amburn wrote:
>> > http://www.sys-con.com/coldfusion/archives/0208/Forta/
>> >
>> > I think Ben explains this pretty good here.
>
>unfortunately, his article completely contradicts some of the statements
>made earlier in this thread. Ben says:
>
>"...CF developers typically create variables in the APPLICATION scope...and
>are careful never to overwrite them. If an application contained variables
>like this, variables that were never updated (after initial creation), you
>wouldn't really need to lock them at all."
>
>so according to Ben Forta, the only time you need to lock an application
>variable is when you are changing the value (i.e. CFSET), *NOT* when you are
>simply reading it (i.e. CFOUTPUT). But Zack said in a previous reply:
>
>"IT IS AN ABSOLUTE NECESITY THAT YOU LOCK ALL SESSION, APPLICATION, AND
>SERVER VARIABLES WHEN YOU WRITE OR READ THEM."
>
>i will say that this is one thing that our organization is struggling
>with... in almost every question, someone says one thing and someone else
>says another. there doesn't seem to be much agreement anymore in the
>community. perhaps this is because allaire has changed CF so much with 4 and
>4.5, but it certainly doesn't look good when i research something like
>CFLOCK and create a standard to use it only to find out that someone else is
>saying otherwise.
>
>anyone else feel like this?
>
>-mike
>
>------------------------------------------------------------------------------
>Archives: http://www.mail-archive.com/[email protected]/
>To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
>message to [EMAIL PROTECTED] with 'unsubscribe' in the body. 


---------------------------------------------------------------------------
Peter Theobald, Chief Technology Officer
LiquidStreaming http://www.liquidstreaming.com
[EMAIL PROTECTED]
Phone 1.212.545.1232 Fax 1.212.679.8032

--=====================_3589612==_.ALT
Content-Type: text/html; charset="us-ascii"

<html>
<font size=3>He did not contradict himself or anyone else in this thread
at all.<br>
You must lock Application variables when reading or writing. If you only
locked when writing, the reads would run without even checking if there
was a write lock at that moment.<br>
<br>
One frequently encountered exception is when you define an Application
variable ONLY ONCE at the beginning of the application (usually in
Application.cfm)&nbsp; like this:<br>
<br>
&lt;CFIF NOT IsDefined(&quot;Application.GlobalVar&quot;)&gt;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>...lock it
&amp; set it once and never again...<br>
&lt;/CFIF&gt;<br>
<br>
The reason this is an exception is because you KNOW ahead of time as the
programmer that there is ZERO chance of the code trying to read and write
the variable at the same time because you will NEVER write it again after
that one first CFSET that will run the first time the first page is
loaded.<br>
<br>
Oh, and if what I just said it correct I must finally understand how this
works! :-)<br>
<br>
<br>
At 03:45 PM 7/28/00 -0400, Mike Amburn wrote:<br>
<blockquote type=cite cite>&gt; &gt;
<a href="http://www.sys-con.com/coldfusion/archives/0208/Forta/" 
eudora="autourl">http://www.sys-con.com/coldfusion/archives/0208/Forta/</a><br>
&gt; &gt;<br>
&gt; &gt; I think Ben explains this pretty good here.<br>
<br>
unfortunately, his article completely contradicts some of the
statements<br>
made earlier in this thread. Ben says:<br>
<br>
&quot;...CF developers typically create variables in the APPLICATION
scope...and<br>
are careful never to overwrite them. If an application contained
variables<br>
like this, variables that were never updated (after initial creation),
you<br>
wouldn't really need to lock them at all.&quot;<br>
<br>
so according to Ben Forta, the only time you need to lock an
application<br>
variable is when you are changing the value (i.e. CFSET), *NOT* when you
are<br>
simply reading it (i.e. CFOUTPUT). But Zack said in a previous
reply:<br>
<br>
&quot;IT IS AN ABSOLUTE NECESITY THAT YOU LOCK ALL SESSION, APPLICATION,
AND<br>
SERVER VARIABLES WHEN YOU WRITE OR READ THEM.&quot;<br>
<br>
i will say that this is one thing that our organization is
struggling<br>
with... in almost every question, someone says one thing and someone
else<br>
says another. there doesn't seem to be much agreement anymore in 
the<br>
community. perhaps this is because allaire has changed CF so much with 4
and<br>
4.5, but it certainly doesn't look good when i research something
like<br>
CFLOCK and create a standard to use it only to find out that someone else
is<br>
saying otherwise.<br>
<br>
anyone else feel like this?<br>
<br>
-mike<br>
<br>
------------------------------------------------------------------------------<br>
Archives:
<a href="http://www.mail-archive.com/[email protected]/" 
eudora="autourl">http://www.mail-archive.com/[email protected]/</a><br>
To Unsubscribe visit
<a href="http://www.houseoffusion.com/index.cfm?sidebar=lists&amp;body=lists/cf_talk" 
eudora="autourl">http://www.houseoffusion.com/index.cfm?sidebar=lists&amp;body=lists/cf_talk</a>
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. 
</font></blockquote><br>

<font size=2><b><br>
---------------------------------------------------------------------------<br>
Peter Theobald, </b>Chief Technology Officer<br>
</font><font size=3 color="#0000FF"><b>LiquidStreaming </b></font><a 
href="http://www.liquidstreaming.com/" eudora="autourl"><font size=2 
color="#0000FF"><u>http://www.liquidstreaming.com</a><br>
</u></font><font size=2>[EMAIL PROTECTED]<br>
<b>Phone</b> 1.212.545.1232 <b>Fax</b> 1.212.679.8032<br>
</font></html>

--=====================_3589612==_.ALT--

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to