require 'thread'
THREAD_NUM = 4
list = ['*',
'_*',
'__*',
'___*',
'____*',
'_____*',
'______*',
'_______*',
'________*',
'_________*',]
locker = Mutex.new
list0 = list.dup
Array.new(THREAD_NUM) do
Thread.new do
while a = list0.shift
locker.synchronize do
# sleep 0.1
puts a
end
end
end
end.each(&:join)