Class: InternetHakai::RequestPoolNonThread
Constant Summary
collapse
- UNIQUE_BY_THREAD =
false
Instance Method Summary
collapse
Methods inherited from BaseHandler
clear, clearall, get_class, get_config, get_handler, get_instance, get_instance_thread, get_thread_id, #on_create, set_config, set_thread_id, unique_by_thread?
Constructor Details
Returns a new instance of RequestPoolNonThread.
51
52
53
54
55
|
# File 'lib/internethakai/executor.rb', line 51
def initialize id
@queue = []
@closed = false
@enable = true
end
|
Instance Method Details
#add(action) ⇒ Object
62
63
64
65
|
# File 'lib/internethakai/executor.rb', line 62
def add action
return unless @enable
@queue << action
end
|
#clear ⇒ Object
56
57
58
|
# File 'lib/internethakai/executor.rb', line 56
def clear
@queue = []
end
|
#close ⇒ Object
74
75
76
|
# File 'lib/internethakai/executor.rb', line 74
def close
@closed = true
end
|
#empty? ⇒ Boolean
59
60
61
|
# File 'lib/internethakai/executor.rb', line 59
def empty?
@queue.empty?
end
|
#get ⇒ Object
66
67
68
69
70
71
72
73
|
# File 'lib/internethakai/executor.rb', line 66
def get
return -1 if @closed
if ! @enable and @queue.empty?
close
return -1
end
@queue.shift
end
|
#quit ⇒ Object
77
78
79
80
|
# File 'lib/internethakai/executor.rb', line 77
def quit
@enable = false
close if @queue.empty?
end
|