<!--- checks to see if I need to lock to a single thread --->
<cflock timeout="30" scope="SESSION" type="READONLY">
<cfif not parameterexists(session.jobType)>
<cfset doisetjobtype="yes">
</cfif>
</cflock>
<cfif doisetjobtype is "yes">
<cflock timeout="30" scope="SESSION" type="EXCLUSIVE">
<!--- Insures that I still need to set this variable, not
set by another thread --->
<cfif not parameterexists(session.jobType)>
<cfset session.jobType='active'>
</cfif>
</cflock>
</cfif>
-----Original Message-----
From: Chris Norloff [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 25, 2000 1:48 PM
To: CF-Talk
Subject: Lock once or twice?
Hi, I'm working on a system with CFIF statements reading session variables,
then CFSET statements setting session variables.
Is it better to
1. use one EXCLUSIVE lock for both the CFIF and CFSET statements, or
2. use an EXCLUSIVE lock around the CFSET statement and a READONLY lock
around the CFIF statement?
And, if option 2 is better, how do I do it without nesting CFLOCK statements
(which I understand shouldn't be done)? [Use a temporary variable?]
thanks,
Chris Norloff
EXAMPLE - EXCLUSIVE lock protects both read and write accesses, but is there
a faster way?
<cflock timeout='99' name="#session.sessionID#" type="EXCLUSIVE">
<cfif not parameterexists(session.jobType)>
<cfset session.jobType='active'>
</cfif>
</cflock>
----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message
with 'unsubscribe' in the body to [EMAIL PROTECTED]