>><cfloop condition="(#datediff('S', tick, now())# LT 5)"></cfloop>Loops like that spike to 100% cpu utilization, not a good method. You can use a tag like cfx_sleep, or the deadlock timeout, which is great on hosts that charge for cfx component installation/use. Matthew P. Smith Web Developer, Object Oriented Naval Education & Training Professional Development & Technology Center (NETPDTC) (850)452-1001 ext. 1245 [EMAIL PROTECTED] >>-----Original Message----- >>From: Bud [mailto:[EMAIL PROTECTED]] >>Sent: Monday, September 23, 2002 3:21 PM >>To: CF-Talk >>Subject: Re: Strange threading issue, cflock? >> >>On 9/23/02, jon hall penned: >>> Using CF5, I have a database insert that I need to pause a few >>> seconds, then select a value back out that is updated from withing >>> the db. My code looks something like this: >>> >>> <cfquery .../> // Insert Query >>> <cfset name = Hash(CreateUUID())/> >>> <cflock name="#name#" type="readonly" timeout="1"> >>> <cflock name="#name#" type="exclusive" timeout="5" >>>throwontimeout="No"></cflock> >>> </cflock> >>> <cfquery .../> // Select Query >>> >>> What is strange is that the second query is not executing after the >>> cflock times out. It seems that it must be executing _before_ the >>> cflock starts! The database usually takes about 1 second to update >>> the field, and even if I set the timeout to 20 seconds the recordset >>> returned always contains data that would indicate that the query >>> didn't wait until the cflock timed out, but executed before the >>> cflock... >> >>I'm not exactly sure if I'm reading your post correctly, but if you >>simply want some code to delay executing for a set amount of time, >>you can use a conditional loop. CFLOCK doesn't actually lock the code >>at that point for the timeout value. The timeout value is how long CF >>will wait until either throwing an error or moving on to the next >>section of code. >> >>In the same below, the Select query will run 5 seconds after the Code >>to activate database Update. >> >><cftry> >> >><cflock name="mylockname" timeout="10" type="exclusive" >>throwontimeout="yes"> >><cfset tick = now()> >>Code to activate database Update begins at >><CFOUTPUT>#TimeFormat(tick, "h:mm:ss")#</CFOUTPUT><p> >><cfloop condition="(#datediff('S', tick, now())# LT 5)"></cfloop> >> >>Select query runs at <CFOUTPUT>#TimeFormat(now(), "h:mm:ss")#</CFOUTPUT> >></cflock> >> >><cfcatch type="lock"> >>The process timed out. Try again. >></cfcatch> >> >></cftry> >> >>-- >> >>Bud Schneehagen - Tropical Web Creations >> >>_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ >>ColdFusion Solutions / eCommerce Development >>[EMAIL PROTECTED] >>http://www.twcreations.com/ >>954.721.3452 >> ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.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

