This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
socket = TCPSocket.new('127.0.0.1', 80) | |
# In JRuby 1.7.10, reading 0 bytes blocks the caller. | |
# In MRI 1.9.3 and 2.1.1, reading 0 bytes immediately returns an empty string. | |
socket.read(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
puts "PID: #{$$}" | |
trap("USR1") do | |
@dump = true | |
end | |
t = Thread.new do | |
loop do | |
print '<' |