<CFLOCK> Tag - ColdFusion
>> Return to ColdFusion Tag Index
The <CFLOCK> tag allows you ...
<CFLOCK> Comments from Macromedia LiveDocs
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p71.htm
FYI a cfreturn inside a cflock seems to work in CF 7.02 - not saying that it's a best practice or that the engineers have checked it out. That said it is a very common use case if you are trying to provide safe concurrent access to a bean property's getter method.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p71.htm
<CFRETURN> within <CFLOCK>
Do you mean it's not good practice or it produces an error, i.e., the lock is not released?
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p71.htm
It should be noted that functions cannot return a value from within a cflock. The following is a simple example to demonstrate my point.
<cfoutput>#getVar("uservo")#</cfoutput>
<cffunction name="getVar" access="public" returntype="any" output="false"
displayname="" hint="Retrieves a variable from the session.">
<cfargument name="varName" type="variablename" required="true"
displayname="" hint="Variable to retrieve from session." />
<cflock name="readSessionVariable" timeout="10" type="readonly">
<cfif structKeyExists(session,arguments.varName)>
<cfreturn evaluate("session." & arguments.varName)/>
</cfif>
</cflock>
<cfdump var="qadfsdf"><cfabort >
<cfthrow message="Element #arguments.varName# is undefined in Session." type="session"/>
<cfreturn/>
</cffunction>
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p71.htm
This page should indicate that if you set timeout="0", the timeout is determined by the "Timeout Requests after x" setting in the ColdFusion MX Administrator Settings page, if that setting is enabled. If the Administrator "Timeout Requests after x" setting is not enabled and you set the timeout attribute to 0, ColdFusion can wait indefinitely to obtain the lock.
Also, in the first deadlock example, it is not obvious that the line with the two Deadlock: entries is part of the table and has two columns.
[Top]
Recommended Books
COLDFUSION MX Web Application Construction Kit (5th Edition)
Authors: Ben Forta and Nate Weiss
1500 pages
[Top]
Web Sites
Macromedia
The makers of ColdFusion/ColdFusion MX.
ColdFusion Developer's Journal
Forta.com (ColdFusion Section)
Ben Forta is Macromedia's Senior Technical Evangelist. Here on his site find useful ColdFusion information.
Flash CFM
Flash and ColdFusion Development.
Handling file uploads without CFFILE
BLOG post by "Sam" on REWINDLIFE.COM gives insight into how to upload a file on your site if you are not allowed to use the CFFILE tag.
[Top]
Copyright © 2003- 2008, Orville Paul Chomer, All Rights Reserved
Home Page
Blog
How To
Chomer TV
The Show
Webcam Videos
Freeware
•
VB Mahjongg
Coding
•
ColdFusion
•
Javascript
•
Visual Basic
Other Places
Acoustic Eidolon
History Singers
Scobleizer
Beach Walks
Freshtopia
CSS Zen Garden