Method: Zoidberg::HardShell#async

Defined in:
lib/zoidberg/shell.rb

#async(locked = false, &block) ⇒ AsyncProxy, NilClass

Perform an async action

Parameters:

  • locked (Truthy, Falsey) (defaults to: false)

    lock when running

Returns:



167
168
169
170
171
172
173
174
175
176
177
# File 'lib/zoidberg/shell.rb', line 167

def async(locked=false, &block)
  if(block)
    if(locked)
      current_self.instance_exec(&block)
    else
      current_self._async_request(locked ? :blocking : :nonblocking, :instance_exec, &block)
    end
  else
    ::Zoidberg::HardShell::AsyncProxy.new(current_self, locked)
  end
end