« Previous | Next » 

Revision e6c200d6

IDe6c200d61554b9cd06c203a8800e94941de82a6a
Parent aaae9bc0
Child 488b540d

Added by Guido Trotter about 14 years ago

LockSet: make acquire() fail faster on wrong locks

This patch makes acquire() first look up all the locks in the dict and then try
to acquire them later. The advantage is that if a lockname is already wrong
since the beginning we won't need to first queue and acquire other locks to
find this out.

Of course since there is no locking between the two steps a delete() could
still happen in between, but SharedLocks are safe in this regard and will just
make the .acquire() operation fail if this unfortunate condition happens.

Since the right way to check if an instance/node exists and make sure it won't
stop existing after that is acquiring its lock this improves the common case
(checking for an incorrect name) while not penalizing correctness, or
performance as would happen if we kept a lock for the whole process.

Reviewed-by: iustinp

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences