Guest User

Untitled

a guest
Apr 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. $null = File.open('/dev/null', 'w')
  2.  
  3. threads = []
  4. max_threads = 5000
  5.  
  6. loop do
  7. threads << Thread.new do
  8. str = 'x' * 500
  9. $null.write(str)
  10. end
  11.  
  12. if threads.length >= max_threads
  13. threads.each { |t| t.join }
  14. threads = []
  15. end
  16. end
Add Comment
Please, Sign In to add comment