Class: Concurrent::Synchronization::Object

Inherits:
Implementation
  • Object
show all
Defined in:
lib/concurrent/synchronization/object.rb,
lib/concurrent/synchronization/condition.rb

Overview

Note:

this object does not support usage together with Thread#wakeup and 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.

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.

Examples:

simple

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

  def value
    synchronize { @value }
  end
end

See Also:

  • implementation as an example of this class use

Instance Method Summary collapse

Instance Method Details

#new_condition ⇒ Object



48
49
50
# File 'lib/concurrent/synchronization/condition.rb', line 48

def new_condition
  Condition.private_new(self)
end