Module: ConcurrentWorker::ConcurrentThread

Defined in:
lib/concurrent_worker/worker.rb

Instance Method Summary collapse

Instance Method Details

#channel_closeObject



226
227
228
# File 'lib/concurrent_worker/worker.rb', line 226

def channel_close
  @thread_channel.close
end

#cncr_blockObject



207
208
209
210
211
212
# File 'lib/concurrent_worker/worker.rb', line 207

def cncr_block
  @thread_channel = Queue.new
  @thread = result_handle_thread do
    yield_base_block
  end
end

#receive_reqObject



218
219
220
# File 'lib/concurrent_worker/worker.rb', line 218

def receive_req
  @thread_channel.pop
end

#send_req(args) ⇒ Object



214
215
216
# File 'lib/concurrent_worker/worker.rb', line 214

def send_req(args)
  @thread_channel.push(args)
end

#send_res(args) ⇒ Object



222
223
224
# File 'lib/concurrent_worker/worker.rb', line 222

def send_res(args)
  call_result_callbacks(args)
end

#wait_cncr_procObject



230
231
232
# File 'lib/concurrent_worker/worker.rb', line 230

def wait_cncr_proc
  @thread && @thread.join
end