> > Does anyone know how to go about locking this line?
> >
> > <CFSET APPLICATION.USERSLOGGEDIN["#Session.UserID#"].
> > TIMECREATED = NOW()>
>
> <!--- create copy of Session.UserID --->
> <!--- substitute SCOPE param for NAME if using CF 4.5 --->
> <CFLOCK NAME="#Session.SessionID#" TYPE="readonly" TIMEOUT="30">
>     <CFSET localUserID = Session.UserID>
> </CFLOCK>
> <!--- now write the application param --->
> <CFLOCK NAME="#Application.ApplicationName#" TYPE="readonly"
> TIMEOUT="30">
>     <CFSET UsersLoggedIn[localUserID].TimeCreated = Now()>
> </CFLOCK>

The problem with this answer is that you're referencing memory variables in
your NAMEs without locking those references! This problem has been discussed
here previously; I'm aware that Allaire's own recommendation under CF 4.0.x
was to name CFLOCKs using Session.SessionID and Application.ApplicationName.
Other alternatives have been suggested, but the implicit naming problem is,
I think, why Allaire added the SCOPE attribute in 4.5.x.

Also, in the second lock, you'd want a TYPE="EXCLUSIVE" lock; whenever
you're writing to memory variables, you want an exclusive lock.

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

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to