worker_pool

时间:2021-02-15 21:30:16
【文件属性】:
文件名称:worker_pool
文件大小:10KB
文件格式:ZIP
更新时间:2021-02-15 21:30:16
Elixir 工人池 用户定义的工作程序的池模块。 例子 以下模块是一个示例工作程序模块,该模块在调用后将:ok和每个元素的双精度列表发送到主机进程。 defmodule SampleWorker do use WorkerPool . Worker @impl true def work ({pid, list}), do: send (pid, { :ok , Enum . map (list, & &1 * 2 )}) end WorkerPool . start_link ( SampleWorker ) WorkerPool . get_worker ( SampleWorker ) |> send ({ :work , { self (), [ 1 , 2 , 3 ]}}) receive do { :ok , result} -> IO . inspect result
【文件预览】:
worker_pool-main
----mix.exs(835B)
----LICENSE.txt(11KB)
----lib()
--------worker_pool()
--------worker_pool.ex(3KB)
----.formatter.exs(97B)
----test()
--------test_helper.exs(15B)
--------worker_pool_test.exs(403B)
--------support()
----README.md(1KB)
----mix.lock(2KB)
----.gitignore(622B)

网友评论