@!visibility private @!macro internal_implementation_note
# File lib/concurrent/synchronization/rbx_object.rb, line 55 def self.attr_volatile *names names.each do |name| ivar = :"@volatile_#{name}" class_eval def #{name} Rubinius.memory_barrier #{ivar} end def #{name}=(value) #{ivar} = value Rubinius.memory_barrier end, __FILE__, __LINE__ + 1 end names.map { |n| [n, :"#{n}="] }.flatten end
# File lib/concurrent/synchronization/rbx_object.rb, line 50 def ensure_ivar_visibility! # Rubinius instance variables are not volatile so we need to insert barrier Rubinius.memory_barrier end
# File lib/concurrent/synchronization/rbx_object.rb, line 45 def ns_broadcast @Waiters.shift << true until @Waiters.empty? self end
# File lib/concurrent/synchronization/rbx_object.rb, line 40 def ns_signal @Waiters.shift << true unless @Waiters.empty? self end
# File lib/concurrent/synchronization/rbx_object.rb, line 20 def ns_wait(timeout = nil) wchan = Rubinius::Channel.new begin @Waiters.push wchan Rubinius.unlock(self) signaled = wchan.receive_timeout timeout ensure Rubinius.lock(self) if !signaled && !@Waiters.delete(wchan) # we timed out, but got signaled afterwards, # so pass that signal on to the next waiter @Waiters.shift << true unless @Waiters.empty? end end self end
Generated with the Darkfish Rdoc Generator 2.