Ruby/Threads/Thread.pass

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск

cede control from a thread

2.times { Thread.new { 10.times { |i| print i; $stdout.flush; Thread.pass } } }
Thread.list.each { |thread| thread.join unless thread == Thread.main }