[erlang-patches] [PATCH] erts: fix error handling in bif erlang:start_timer/3

Henrik Nord <>
Tue Jan 3 16:20:20 CET 2012


We will not include this patch as it conflict with how Erlang normally 
behaves when working with dead processes.

Thank you for the contribution.

On 12/28/2011 08:56 AM, Jovi Zhang wrote:
> > From 18612f43f0c8a6f217806c22c9f9bec8b0de4b26 Mon Sep 17 00:00:00 2001
> From: Jovi Zhang<>
> Date: Wed, 21 Dec 2011 03:26:03 +0800
> Subject: [PATCH] erts: fix error handling in bif erlang:start_timer/3
>
> See below, When recevier pid is non-exist, start_timer/3 return a
> valid internal Ref, this is wrong, erlang should return badarg instead.
>
> Eshell V5.9  (abort with ^G)
> 1>  A = erlang:start_timer(100*1000, pid(0, 9999, 0), {none}).
> Ref<0.0.0.29>
> 2>  erlang:read_timer(A).
> false
> 3>
> ---
> erts/emulator/beam/erl_bif_timer.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/erts/emulator/beam/erl_bif_timer.c
> b/erts/emulator/beam/erl_bif_timer.c
> index a922a33..7bd2b8e 100644
> --- a/erts/emulator/beam/erl_bif_timer.c
> +++ b/erts/emulator/beam/erl_bif_timer.c
> @@ -414,7 +414,7 @@ setup_bif_timer(Uint32 xflags,
>         rp = erts_pid2proc(c_p, ERTS_PROC_LOCK_MAIN,
>                            receiver, ERTS_PROC_LOCK_MSGQ);
>         if (!rp)
> -           return ref;
> +           return THE_NON_VALUE;
>      }
>
>      if (timeout<  ERTS_ALC_MIN_LONG_LIVED_TIME) {
> --
> 1.7.2.3
>
>
> _______________________________________________
> erlang-patches mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-patches

-- 
/Henrik Nord Erlang/OTP

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20120103/93777298/attachment.html>


More information about the erlang-patches mailing list