Class Methods
::
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 973
def initialize(size)
@size = size
@taken_count = 0
@rpipe, @wpipe = IO.pipe
@results = []
@mutex = Mutex.new
end
No documentation available
Instance Methods
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 985
def add(family, result)
@mutex.synchronize do
@results.push [family, result]
@wpipe.putc HOSTNAME_RESOLUTION_QUEUE_UPDATED
end
end
No documentation available
#
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 1007
def close
@rpipe.close
@wpipe.close
end
No documentation available
#
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 992
def get
return nil if @results.empty?
res = nil
@mutex.synchronize do
@rpipe.getbyte
res = @results.shift
end
@taken_count += 1
close if @taken_count == @size
res
end
No documentation available
#
ext/socket/lib/socket.rb
View on GitHub
# File tmp/rubies/ruby-master/ext/socket/lib/socket.rb, line 981
def notifier
[@rpipe]
end
No documentation available