Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spawn vs Apply in worker code. #45

Closed
j-mcnally opened this issue Nov 10, 2014 · 1 comment
Closed

Spawn vs Apply in worker code. #45

j-mcnally opened this issue Nov 10, 2014 · 1 comment

Comments

@j-mcnally
Copy link
Collaborator

I was doing some perusing of erlang and found

http://www.erlang.org/doc/reference_manual/processes.html

It looks like we can

  def dispatch_work(worker_module, method, args) do
    :erlang.spawn(String.to_atom("Elixir.#{worker_module}"), method, args)
  end

instead of

  def dispatch_work(worker_module, method, args) do
    :erlang.apply(String.to_atom("Elixir.#{worker_module}"), method, args)
  end

This will actually run the worker code as its own process. Im not 100% sure what this does vs having a worker process, but wanted to throw it out there incase it could help clean up the api at all.

@akira
Copy link
Owner

akira commented Nov 10, 2014

Thanks, will take a look. We may still need the worker process since we're using it as gen_server to track termination, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants