Hi Marcos,
Making lock() reentrant simply means that if you call lock() multiple times on the same recNo, you get
exactly the same lock as if you'd called only once. So I don't need a "lock reference count".
So the example you wrote :
becomes :
Yes, I implement a LockManager class to which Data delegates the locking, but it was quite simple too. The key point is to keep record of "who" owns the lock, I mean the
thread which called the lock() method. From there, lock() reentrance becomes natural, but deadlock prevention is easy to implement too.
Regards,
Phil.