1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
THREADS = 10 1000 do threads = [] THREADS do threads << Thread do sleep end end if (size = Thread) != THREADS + 1 raise "wrong! (expected but was )" end threads do |t| Thread until t == 'sleep' t t end end |

