From 80284301a71d390f5cacd298baa3a6e6aeb91390 Mon Sep 17 00:00:00 2001 From: Patrick Mahoney Date: Thu, 29 Mar 2012 22:34:16 -0500 Subject: [PATCH] Use semaphore#synchronize convenience method internally. --- lib/process_shared/mutex.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/process_shared/mutex.rb b/lib/process_shared/mutex.rb index 1aab1ed..2b31d58 100644 --- a/lib/process_shared/mutex.rb +++ b/lib/process_shared/mutex.rb @@ -108,13 +108,8 @@ module ProcessShared end end - def with_internal_lock - @internal_sem.wait - begin - yield - ensure - @internal_sem.post - end + def with_internal_lock(&block) + @internal_sem.synchronize &block end end end