[erlang-questions] max timeout

Alpár Jüttner alpar@REDACTED
Wed Aug 20 07:26:00 CEST 2008


Hi,

As I recall, someone noted on that thread that timer:sleep() works well
for arbitrarily large numbers.

Now I looked at the source and found that this is _not_ true. Strangely
enough, all the functions of the timer modules seem to work correctly
with large numbers _except_ timer:sleep() which has a definition as
simple as this:

sleep(T) ->
    receive
    after T -> ok
    end.

It might be worth fixing.

> 1. 2^32 (this is what's documented, but only seems to work in the shell)
> 2. 2^32-1 = 49.5 days
> 3. Erlang's small integers (2^27-1 = 1.5 days)

4. timer.erl says this:
-define(MAX_TIMEOUT, 16#0800000).

Best regards,
Alpar





More information about the erlang-questions mailing list