Method: Ccrpc::RpcConnection::Call#call_back
- Defined in:
- lib/ccrpc/rpc_connection.rb
#call_back(func, params = {}, &block) ⇒ Object
Send a dedicated callback to the caller’s block.
If Ccrpc::RpcConnection#call is called with both function name and block, then it’s possible to call back to this dedicated block through #call_back . The library ensures, that the callback ends up in the corresponding call block and in the same thread as the caller, even if there are multiple simultaneous calls are running at the same time in different threads or by using lazy_answers .
Yielded parameters and returned objects are described in Ccrpc::RpcConnection#call.
72 73 74 75 |
# File 'lib/ccrpc/rpc_connection.rb', line 72 def call_back(func, params={}, &block) raise CallAlreadyReturned, "Callback is no longer possible since the call already returned #{self.inspect}" if @answer conn.send(:call_intern, func, params, @id, &block) end |