class Sequel::Database::AsyncThreadPool::Proxy
Default object class for async job/proxy result. This uses a queue for synchronization. The JobProcessor
will push a result until the queue, and the code to get the value will pop the result from that queue (and repush the result to handle thread safety).
Public Class Methods
new()
click to toggle source
Calls superclass method
Sequel::Database::AsyncThreadPool::BaseProxy::new
# File lib/sequel/extensions/async_thread_pool.rb 297 def initialize 298 super 299 @queue = ::Queue.new 300 end
Private Instance Methods
__get_value()
click to toggle source
# File lib/sequel/extensions/async_thread_pool.rb 308 def __get_value 309 @value = @queue.pop 310 311 # Handle thread-safety by repushing the popped value, so that 312 # concurrent calls will receive the same value 313 @queue.push(@value) 314 end
__run()
click to toggle source
# File lib/sequel/extensions/async_thread_pool.rb 304 def __run 305 @queue.push(__run_block) 306 end