RustlerElixirFun.Pool (rustler_elixir_fun v0.1.0)
This Supervisor manages a pool of worker processes which will each listen to native code sending sets of functions + parameters.
Currently uses the default options:
[name: RustlerElixirFun.Pool, size: 50, max_overflow: 20]
Note that when starting, the 'name' will be used as registered name for the RustlerElixirFun.Pool.PoolMaster
process.
You can use this name directly in the native Rust code.
(If you ever need to interact with the poolboy pool itself: its name will be name
+ .PoolboyPool
).
iex> Supervisor.start_link(RustlerElixirFun.Pool, [name: MyPool])
iex> ((1..100)
iex> |> Task.async_stream(fn i -> RustlerElixirFun.Internal.apply_elixir_fun(MyPool, fn x -> x * 2 end, [i]) end, max_concurrency: 50)
iex> |> Enum.to_list
iex> |> Enum.map(fn {:ok, {:ok, val}} -> val end)
iex> |> Enum.sum() )
10100
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Link to this section Functions
Link to this function
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
Link to this function