1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
iex(1)> ExampleCode.example_await(1000, 500)
{:ok, 1000, 500, :ok}
iex(2)> ExampleCode.example_await(100, 500)
{:exit, 100, 500,
{:timeout,
{Task, :await,
[
%Task{
owner: #PID<0.90.0>,
pid: #PID<0.94.0>,
ref: #Reference<0.1796741474.2735472644.117839>
},
100
]}}}
iex(3)> ExampleCode.example_await(:infinity, 500)
{:ok, :infinity, 500, :ok}
iex(4)> ExampleCode.example_yield(:infinity, 500)
{:ok, :infinity, 500, {:ok, :ok}}
iex(5)> ExampleCode.example_yield(100, 500)
{:ok, 100, 500, nil}
iex(6)> ExampleCode.example_yield(1, 500)
{:ok, 1, 500, nil}
iex(7)> try do
...(7)> ExampleCode.example_yield(:invalid, 500)
...(7)> rescue
...(7)> e in ErlangError -> e
...(7)> end
%ErlangError{original: :timeout_value}
|