> I have done locks when ever I set a Session var.
> Do I have to use a lock  when ever I use the var?
> i.e:
> 
>       <CFLOCK type="readonly" scope="session">
>               <CFSET session.bgcolor = "blue">
>       </CFLOCK>
> 
> 
> <body bgcolor=#session.bgcolor#>
> 
> Are you saying I need to place a lock around the <body> tag?

Yes, you need to place a lock around any reads or writes of Session
variables. If you don't lock reads as well as writes, and there's any
possibility of the two operations happening simultaneously (and there
usually is), then the lock you put on the write is useless by itself.

Locking in CF (and in databases as well) is essentially a cooperative
venture. Placing one lock on one piece of code doesn't do any good if
another piece of code accesses the resource without a lock.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to