0

Where does <cflock> go? Should it be located in the Application.cfm file, or can it be placed in any arbitrary .cfm file?

<CFLOCK SCOPE="Session" TYPE="Exclusive" 
    TIMEOUT="30" THROWONTIMEOUT="Yes">

Leigh
  • 28,765
  • 10
  • 55
  • 103
dannyrosalex
  • 1,794
  • 4
  • 16
  • 25
  • 2
    along with any answers you get, read this post too. http://stackoverflow.com/questions/13190209/how-to-make-a-shared-resource-thread-safe-when-using-dependency-injection/13195325 – genericHCU Nov 30 '12 at 17:35

1 Answers1

3

It can be placed in any file.

However, don't just use it everywhere without thinking - too much locking can be just as bad as not enough locking.

In particular, be careful not to create deadlocks (by placing competing locks that might both end up waiting for the other to complete, meaning neither of them can process).

There is useful info (including some good links) here: How to make a shared resource thread-safe when using dependency injection?

You can also look at questions tagged with both and for more interesting reading: https://stackoverflow.com/questions/tagged/coldfusion+locking

Community
  • 1
  • 1
Peter Boughton
  • 110,170
  • 32
  • 120
  • 176