Task.shutdown
shutdown
, go back to Task module for more information.
Specs
Unlinks and shuts down the task, and then checks for a reply.
Returns {:ok, reply}
if the reply is received while shutting down the task,
{:exit, reason}
if the task died, otherwise nil
.
The second argument is either a timeout or :brutal_kill
. In case
of a timeout, a :shutdown
exit signal is sent to the task process
and if it does not exit within the timeout, it is killed. With :brutal_kill
the task is killed straight away. In case the task terminates abnormally
(possibly killed by another process), this function will exit with the same reason.
It is not required to call this function when terminating the caller, unless
exiting with reason :normal
or if the task is trapping exits. If the caller is
exiting with a reason other than :normal
and the task is not trapping exits, the
caller's exit signal will stop the task. The caller can exit with reason
:shutdown
to shut down all of its linked processes, including tasks, that
are not trapping exits without generating any log messages.
If a task's monitor has already been demonitored or received and there is not
a response waiting in the message queue this function will return
{:exit, :noproc}
as the result or exit reason can not be determined.