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
# File lib/sequel/extensions/async_thread_pool.rb, line 303
def initialize
  super
  @queue = ::Queue.new
end

Private Instance Methods

__get_value() click to toggle source
# File lib/sequel/extensions/async_thread_pool.rb, line 314
def __get_value
  @value = @queue.pop

  # Handle thread-safety by repushing the popped value, so that
  # concurrent calls will receive the same value
  @queue.push(@value)
end
__run() click to toggle source
# File lib/sequel/extensions/async_thread_pool.rb, line 310
def __run
  @queue.push(__run_block)
end