4 ms·
The source code for Task is very readable but also kind of subtle, and makes for a good study. I would say definitely give it a shot to trace the flow from Task
by asa400 2y ago
The source code for Task is very readable but also kind of subtle, and makes for a good study. I would say definitely give it a shot to trace the flow from Task.async[0] to Task.await[1] to Task.Supervised.start_link[2] to Task.Supervised.reply[3]. There is some subtle interplay with regard to waiting for messages/timeouts and process links.
[0] - https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/elixir/lib/task.ex#L496-L506 https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/elixi...
[1] - https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/elixir/lib/task.ex#L855-L876 https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/elixi...
[2] - https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/elixir/lib/task/supervised.ex#L13-L15 https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/elixi...
[3] - https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/elixir/lib/task/supervised.ex#L30-L63 https://github.com/elixir-lang/elixir/blob/v1.16.3/lib/elixi...