Module: ProcessShared::SynchronizableSemaphore

Included in:
Mach::Semaphore, Posix::Semaphore
Defined in:
lib/process_shared/synchronizable_semaphore.rb

Defined Under Namespace

Classes: FasterUncheckedMutex

Instance Method Summary collapse

Instance Method Details

#synchronizeObject

Yield the block after decrementing the semaphore, ensuring that the semaphore is incremented.

Returns:

  • (Object)

    the value of the block



9
10
11
12
13
14
15
16
# File 'lib/process_shared/synchronizable_semaphore.rb', line 9

def synchronize
  wait
  begin
    yield
  ensure
    post
  end
end

#to_mtxFasterUncheckedMutex

Expose an unchecked mutex-like interface using only this semaphore.

Returns:



21
22
23
# File 'lib/process_shared/synchronizable_semaphore.rb', line 21

def to_mtx
  FasterUncheckedMutex.new(self)
end