I've been trying to understand the behavior of cflock so I wrote the 
following test:

<cfscript>

   writeoutput(dateformat(now(), 'mm/dd/yy') & " " & timeformat(now(), 
'HH:mm:ss aa') & "<br>"); 
   flush(); 
   try 
   { 
      lock name="mylock" timeout="1" type="exclusive" throwontimeout="true" 
      { 
         writeoutput("Sleeping...<br/>"); 
         flush(); 
         sleep(10000); 
         writeoutput(dateformat(now(), 'mm/dd/yy') & " " & 
timeformat(now(), 'HH:mm:ss aa') & "<br>"); 
      } 
   } 
   catch(any e) 
   { 
      writedump(e); 
   } 
   writeoutput("That's All Folks!<br/>");
 
</cfscript>


When I open two tabs and refresh this page one or two seconds apart, I was 
expecting that the first one would obtain the lock, sleep 10 seconds, then 
continue.

I thought the second tab would try to obtain the lock, then fail after 1 
second and run the "catch" code.


1. The timeout doesn't seem to do anything. It seems like it will wait 
until the first tab completes then continue.

2. I had thought of the code inside the cflock as the only code that would 
be locked, but the output of the second tab displays the time that the 
first tab completed and the second timestamp 10 seconds after that, so it 
seems like the entire page was locked, not just the code inside the lock.


I'm not saying there is a bug here, maybe I just am not using cflock 
correctly.


Am I doing something wrong here?


Thanks,

John Moss


-- 
-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Open 
BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to