Skip to content

Commit

Permalink
Add example for Queue
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Oct 4, 2014
1 parent 2b34436 commit 924d1b8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions example/queue.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#require 'mruby-thread'

q = Queue.new
th = Thread.new(q) do |q|
q.push 1
q.push 2
q.push 3
nil
end
while true
Thread.sleep 1
v = q.shift
break unless v
puts v
end
th.join

0 comments on commit 924d1b8

Please sign in to comment.