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 # @return [Boolean] +true+ if currently locked
def locked? def locked?
@sem.try_wait acquired = try_lock
@sem.post unlock if acquired
false !acquired
rescue Errno::EAGAIN
true
end end
# Releases the lock and sleeps timeout seconds if it is given and # Releases the lock and sleeps timeout seconds if it is given and