类 Socket::HostnameResolutionResult
公共类方法
new(size) 点击切换源代码
# File socket/lib/socket.rb, line 979 def initialize(size) @size = size @taken_count = 0 @rpipe, @wpipe = IO.pipe @results = [] @mutex = Mutex.new end
公共实例方法
add(family, result) 点击切换源代码
# File socket/lib/socket.rb, line 991 def add(family, result) @mutex.synchronize do @results.push [family, result] @wpipe.putc HOSTNAME_RESOLUTION_QUEUE_UPDATED end end
close() 点击切换源代码
# File socket/lib/socket.rb, line 1013 def close @rpipe.close @wpipe.close end
get() 点击切换源代码
# File socket/lib/socket.rb, line 998 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
notifier() 点击切换源代码
# File socket/lib/socket.rb, line 987 def notifier [@rpipe] end