class PDO::Task
Public Class Methods
new()
click to toggle source
# File lib/pdo/task.rb, line 72 def initialize @task_q = Queue.new end
Public Instance Methods
add(task)
click to toggle source
# File lib/pdo/task.rb, line 76 def add(task) @task_q << task end
next()
click to toggle source
# File lib/pdo/task.rb, line 80 def next begin @task_q.deq(non_block=true) rescue ThreadError nil end end
print_all()
click to toggle source
# File lib/pdo/task.rb, line 92 def print_all tmp_q = Queue.new while not @task_q.empty? do task = @task_q.deq printf "%s\n", task tmp_q << task end @task_q = tmp_q end
size()
click to toggle source
# File lib/pdo/task.rb, line 88 def size @task_q.length end