[erlang-bugs] Annoying catch in timer:tc/3

Torbjorn Tornkvist tobbe@REDACTED
Fri Mar 28 10:39:11 CET 2008


Ulf Wiger (TN/EAB) wrote:
> Torbjorn Tornkvist skrev:
>> Why is it a catch hidden in timer:tc/3 ?
>>
>> tc(M, F, A) ->
>>     Before = erlang:now(),
>>     Val = (catch apply(M, F, A)),        % <== ANNOYING CATCH HERE !!
>>     After = erlang:now(),
>>     {now_diff(After, Before), Val}.
>>
>> I suggest that it is removed.
>>
>> Cheers, Tobbe
> 
> Perhaps a new function then? timer:measure(M,F,A),
> which doesn't catch.

Yes, probably the safest solution :-)

--Tobbe

> 
> BR,
> Ulf W
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-bugs
> 




More information about the erlang-bugs mailing list