Hey, maybe my test case was bad. :) The http call to itself can be a bad thing. :)
I will churn on it some more later. :) Thanks for the empirical data! :) ---------------------------- James Ang Senior Programmer MedSeek, Inc. [EMAIL PROTECTED] -----Original Message----- From: Rob Baxter [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 11:28 AM To: CF-Talk Subject: RE: cflock with timeout=0 Interesting. I found the exact opposite. CFLOCK behaved as I hoped it would. Here is my test script... ------------------------------------------------------------------------ ---- -- <cflock name="MyLock" timeout="0" throwontimeout="no" type="exclusive"> <cfset timeA = GetTickCount() + 15000> <cfloop condition="#timeA# gt #GetTickCount()#"> <cfset val = "wait"> </cfloop> did the lock<BR> </cflock> <BR> done! ------------------------------------------------------------------------ ---- ----- Basically the thing just loops for 15 seconds to give me time to call the page in a different browser. I found that the first instance will run for the entire 15 seconds and display did the lock done! The second instance appears to skip the locked section entirely and immediately displays done! So it would seem that either one of our scripts isn't testing the right thing or that CF5 and CFMX behave differently in this regard. </rob> -----Original Message----- From: James Ang [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 2:06 PM To: CF-Talk Subject: RE: cflock with timeout=0 I thought this was an interesting question, and I decided to write a test script. And from my experiments with CFMX, it would seem that timeout=0 is equivalent to no-timeout. As in, the cf thread will wait() till it obtains the lock. My test script in essence created a deadlock. Something that I thought is not achievable in CFLOCK'ing since the timeout attribute is always required. But setting timeout=0 in essence allows for deadlock scenarios. Here's my deadlock example: <![CDATA[ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <cfparam name="d" type="numeric" default="0"> <cflock timeout="0" throwontimeout="Yes" name="dummy" type="EXCLUSIVE"> <h1>Hello World!</h1> <cfif d NEQ 1> <cfhttp url="http#Iif(CGI.HTTPS IS 'ON', DE('s'), DE(''))#://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#?d=1" method="GET" resolveurl="false" throwonerror="no"></cfhttp> <xmp>#CFHTTP.Header#</xmp> <hr> <cfoutput>#CFHTTP.FileContent#</cfoutput> </cfif> </cflock> </body> </html> ]]> I don't have a CF5 playbox to crash to verify if this is true for CF5. :P ---------------------------- James Ang Senior Programmer MedSeek, Inc. [EMAIL PROTECTED] -----Original Message----- From: Dave Watts [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 11, 2002 11:02 AM To: CF-Talk Subject: RE: cflock with timeout=0 > Can anyone tell me what the behaviour of CFLOCK is when > you give it a timeout value of 0? What I'm looking to do > is create a situation where if one user has acquired the > lock, any other users who reach the lock will immediately > skip the synchronized section. I thought the following > might work... > > <cflock name="MyLock" timeout="0" throwontimeout="no" > type="exclusive"> > ... > </cflock> > > However, I can't find any documentation stating how CF > handles a value of 0 in the timeout field. Will it even > attempt to acquire the lock? In some languages a timeout > of 0 indicates "wait indefinetely" which is obviously > not what I want in this case. I'm running CF5 Pro. Well, I don't know the answer to your question, but you can easily find this out by simply writing some test pages with locks, and running them to see what happens. For example, you could place a lock around a long-running loop, and run that from two separate browsers, or even from one browser using a frameset. The answer that you get this way will be more reliable than any provided by the documentation, which often contains omissions, ambiguities, and even the occasional error. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 ______________________________________________________________________ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

