About lock recursion:

Lock recursion means that a thread that locks a ReaderWriterLockAlt protected resource can request additional locks to the same resource without blocking. This feature comes in handy when you need to call subroutines or event handlers from within the locked section. However, there are some rules:
  • a thread that owns a write lock can recursively acquire more read and / or write locks without blocking. However, during these additional locks ReaderWriterLockAlt remains in Write-locked mode until the outer lock is released.
  • a thread that owns a read lock can recursively acquire more read locks. It is not possible to acquire a writelock from within a readlock (meaning: if you try this anyway, the thread will block forever).

Last edited Dec 18, 2008 at 10:14 PM by jpmikkers, version 2


No comments yet.