[erlang-questions] timer:send_interval/3 how to return {error, Reason} value?

litao cheng litaocheng@REDACTED
Thu Oct 16 10:34:01 CEST 2008


Kenneth , thank you very much!
I just read the timer.erl again, I see in one handle_call cluase, if the
Time and Pid format error, the  {error, badarg} reply will send to the
caller.
please pardon my careless.
:)

2008/10/16 Kenneth Lundin <kenneth.lundin@REDACTED>

> The timer server does never call exit/1.
> The timer server is never supposed to crash, it will be a shutdown of
> the whole E-node if it does.
> The function timer:send_interval(Time,ReceiverPid,Message) will return
> {ok,Ref} if everything is ok and
> {error,badarg} if Time is not an integer, if ReceiverPid is not a pid.
>
>
> /Kenneth Erlang/OTP team, Ericsson
>
> 2008/10/16 litao cheng <litaocheng@REDACTED>:
> > Hi, everyone.
> > When I use timer:send_interval/3, I have some puzzle with the return
> values:
> > {ok, TRef}, {error, Reason}.
> > I see the timer.erl, I know that the timer module is implented by
> gen_server
> > behaviour, the exported functions such as send_after, apply_after and so
> on,
> > are just call the gen_server:call/2. the gen_server:call/2 may invoke
> > erlang:exit/1 with some reasons,
> > but in the timer.erl the timer:req/2 don't catch the exit signal. So I
> > wonder how the timer:send_interval/3 return {error, Reason}. Is it a bug?
> >
> > BS!
> > litaocheng
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081016/3c84b8ee/attachment.htm>


More information about the erlang-questions mailing list