SuperDave to the rescue. :o) You answered my question perfectly.

Robert Everland III
Web Developer
Dixon Ticonderoga


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 10, 2000 6:54 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: What does locking actually do


> In <11451440F335D21197F200104BAFD3A7B70BBE@EXCH2>, Robert Everland
> ([EMAIL PROTECTED]) in a fit of unbridled passion, wrote:
> >     Ok I have the CFX_Excel and it works fine for me, the
> > thing I want to know is what does putting cflock around the
> > tag actually do. I was testing it a second ago with 2 people
> > to see if we would get an error if we click it at the same
> > time( was hoping we didn't) and we didn't. So does cflock
> > que it up for the next person, or what does it do exactly?
>
> As per the documentation: (RTFM, dude)
>
> The CFLOCK tag provides two types of locks to ensure the integrity of
> shared data:
>
> exclusive lock
> read-only lock
> An exclusive lock single-threads access to the CFML constructs in its
> body. Single-threaded access implies that the body of the tag can be
> executed by at most one request at a time. A request executing inside
> a CFLOCK tag has an "exclusive lock" on the tag. No other requests are
> allowed to start executing inside the tag while a request has an
> exclusive lock. ColdFusion issues exclusive locks on a first-come,
> first-served basis.
>
> A read-only lock allows multiple requests to access the CFML constructs
> inside its body concurrently. Therefore, read-only locks should only be
> used when the shared data will only be read and not modified. If another
> request already has an exclusive lock on the shared data, the request
> will wait for the exclusive lock to be released before it can obtain it.

Unfortunately, reading the documentation (or at least the part you quoted)
doesn't really answer Mr. Everland's question - "does CFLOCK queue it up for
the next person?" That is, it doesn't address what actually happens when
concurrent execution occurs. The answer to this is that when one CFLOCK tag
attempts to access a resource locked by another CFLOCK instance (in a way
not allowed by the second CFLOCK), the first CFLOCK will wait for the
specified timeout period. If the second CFLOCK releases the resource before
the timeout, the first will then lock the resource itself and do what it has
to do. If not, the first CFLOCK will fail, throwing an error if the
THROWONTIMEOUT attribute has been set.

Of course, if you've worked with locking in other environments, such as
within database transactions, you might take that knowledge for granted.
It's a mistake, though, to assume that everyone possesses that background
knowledge.

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

----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
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.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
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