> CFLOCK is no longer necessary to prevent memory corruption, but it is
still
> necessary to prevent race conditions in your code.  In other words, if you
> need to ensure that only a single request at a time can access a resource
> (whether a variable in a shared scope, a file on the filesystem, or
> something else) you still need CFLOCK.  You can usually get away without
> locking session access, as long as your site doesn't use frames, but you
> should still put it in there where appropriate.
>

I don't entirely agree here, and I say this out of experience. You don't
need to lock when you're *initially* writing to the shared-scope variable in
question. However, you do need to lock in all other cases, and frames aren't
the only instance.

If I open a browser and then Ctrl+N to open a new browser, that's still
technically a part of the same session, regardless of whether or not I'm
using frames. I would still want to lock to prevent a single user from use
simultaneously writing a variable value at the same time.

I think sometimes "race conditions" get exemplified as <cfset session.foo =
session.foo + 1>. But I think those situations are actually more rare than
multiple browser instances. In my personal opinion, always lock -- it's just
safer that way.

Regards,
Dave.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

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

Reply via email to