Is it possible for a receive statement to have multiple timeout clauses, and if so, what is the correct syntax?
I want to do something like
foo(Timout1, Timeout2) ->
receive
after
Timeout1 ->
doSomething1();
Timeout2 ->
doSomething2()
end.
where, depending on which of Timeout1
or Timeout2
is smaller, doSomething1()
or doSomething2
is called. However, the above code causes a syntax error.
If, as I'm beginning to suspect, this is not possible, what is the best way to achieve the same outcome in a suitable Erlangy manner?
Thanks in advance!