123456789_123456789_123456789_123456789_123456789_

Class: Concurrent::Synchronization::LockableObject

Overview

Safe synchronization under any Ruby implementation. It provides methods like #synchronize, #wait, #signal and #broadcast. Provides a single layer which can improve its implementation over time without changes needed to the classes using it. Use Object not this abstract class.

@note this object does not support usage together with
{file:http://ruby-doc.org/core/Thread.html#method-i-wakeup `Thread#wakeup`}
and {file:http://ruby-doc.org/core/Thread.html#method-i-raise `Thread#raise`}.
{Thread#sleep} and {Thread#wakeup} will work as expected but mixing {Synchronization::Object#wait} and
{Thread#wakeup} will not work on all platforms.

@see Event implementation as an example of this class use

@example simple
class AnClass < Synchronization::Object
  def initialize
    super
    synchronize { @value = 'asd' }
  end

  def value
    synchronize { @value }
  end
end

Instance Method Summary

Instance Method Details

#new_condition

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/synchronization/condition.rb', line 57

def new_condition
  Condition.private_new(self)
end