Actually, you only need to use cflock around shared variable scopes to  
prevent race conditions as the underlying data structures are already  
synchronized at a very low level.  See my weblog post here:

http://markme.com/cantrell/weblog/index.cfm?m=2&d=6&y=2003

Christian

On Tuesday, February 11, 2003, at 03:36 PM, Ryan wrote:

> Scott,
>
> Basically, use cflock around anything to do with application, server,  
> or
> session variables.  When you set one of those variables, set the type  
> to
> "exclusive".  When you read one, use a "readonly" lock.  See below:
>
> <cflock type="exclusive" scope="session" timeout="5">
>     <cfset session.test = 1>
> </cflock>
>
> <cflock type="readonly" scope="session" timeout="5">
>     <cfset request.test = duplicate(session.test)>
> </cflock>
>
> Now you can use "request.test" for the rest of your page without  
> locking and
> unlocking everytime you need it.
>
> Hope that helps,
>
> Ryan
>
> ----- Original Message -----
> From: "Scott Wilhelm" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Tuesday, February 11, 2003 2:17 PM
> Subject: CFLOCK
>
>
>> Can someone please explain to me, in very simply terms, what CFLOCK
>> does, and why/when/where I should use it?
>>
>> I'm trying to build an application, and put it together as proper as  
>> can
>> be, but for some reason, my brain doesn't want to comprehen CFLOCK.
>>
>> Thanks,
>>
>> Scott
>>
>>
>> Scott Wilhelm
>> Computer Technician/Web Developer
>> St. Lawrence-Lewis BOCES
>> PO Box 231, Outer State Street
>> Canton, NY 13617
>>
>> P.         315-386-4504 x 164
>> F.         315-386-3395
>> W.           http://www.sllboces.org
>> E.            [EMAIL PROTECTED]
>>
>>
>>
>>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to