Skip to content

Commit 7fdfbae

Browse files
committed
Clarify the doc for Task.yield
1 parent cca3e17 commit 7fdfbae

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/elixir/lib/task.ex

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,20 +364,21 @@ defmodule Task do
364364
end
365365

366366
@doc """
367-
Yields for a task reply in the given time interval.
367+
Temporarily blocks the current process waiting for a task reply.
368368
369-
Returns `{:ok, reply}` if the reply is received, `{:exit, reason}`
370-
if the task exited or `nil` if no reply arrived.
369+
Returns `{:ok, reply}` if the reply is received, `nil` if
370+
no reply has arrived, or `{:exit, reason}` if the task exited.
371+
Keep in mind that normally this function will exit if the task
372+
process terminates abnormally. `{:exit, reason}` can only be
373+
returned if the task process exited with the reason `:normal`
374+
or if it isn't linked to the caller.
371375
372376
A timeout, in milliseconds, can be given with default value
373377
of `5000`. If the time runs out before a message from
374378
the task is received, this function will return `nil`
375379
and the monitor will remain active. Therefore `yield/2` can be
376380
called multiple times on the same task.
377381
378-
In case the task process dies, this function will exit with the
379-
same reason as the task.
380-
381382
This function assumes the task's monitor is still active or the
382383
monitor's `:DOWN` message is in the message queue. If it has been
383384
demonitored or the message already received, this function will wait

0 commit comments

Comments
 (0)