Module: ConcurrentWorker::ConcurrentThread

Defined in:
lib/concurrent_worker/worker.rb

Instance Method Summary collapse

Instance Method Details

#channel_closeObject



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

def channel_close
  @thread_channel.close
end

#cncr_blockObject



204
205
206
207
208
209
# File 'lib/concurrent_worker/worker.rb', line 204

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

#receive_reqObject



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

def receive_req
  @thread_channel.pop
end

#send_req(args) ⇒ Object



211
212
213
# File 'lib/concurrent_worker/worker.rb', line 211

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

#send_res(args) ⇒ Object



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

def send_res(args)
  call_result_callbacks(args)
end

#wait_cncr_procObject



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

def wait_cncr_proc
  @thread && @thread.join
end