Permalink
Browse files

Hold the mutex in lock_path_exists?

  • Loading branch information...
1 parent 2aa4c0a commit b9cc8034762ff920518fcb351327d1e8dae5ea38 @tsilen tsilen committed Nov 20, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/zk/locker/locker_base.rb
@@ -343,9 +343,11 @@ def create_lock_path!(prefix='lock')
# if we previously had a lock path, check if it still exists
#
def lock_path_exists?
- return false unless @lock_path
- return false unless root_lock_path_same?
- zk.exists?(@lock_path)
+ @mutex.synchronize do
+ return false unless @lock_path
+ return false unless root_lock_path_same?
+ zk.exists?(@lock_path)
+ end
end
# if the root_lock_path has the same stat .ctime as the one

0 comments on commit b9cc803

Please sign in to comment.