Slight refactor to share common code path and clarify behavior

This commit is contained in:
Marc Siegel 2013-12-30 13:22:07 -05:00
parent 49773b66f4
commit ef3d6958ea
1 changed files with 3 additions and 5 deletions

View File

@ -45,11 +45,9 @@ module ProcessShared
# @return [Boolean] +true+ if currently locked
def locked?
@sem.try_wait
@sem.post
false
rescue Errno::EAGAIN
true
acquired = try_lock
unlock if acquired
!acquired
end
# Releases the lock and sleeps timeout seconds if it is given and