[erlang-questions] now() on SMP

Kenneth Lundin <>
Wed Jun 27 17:11:48 CEST 2007


Hi,

As far as we know the rumour is false.

It is a very important property that erlang:now/0 always returns
unique and increasing values for each call.
The support for SMP does not change this.

If think that you have found that erlang:now does not work as
documented you are more than welcome to provide 1) a test case showing
the faulty behaviour 2) a patch which solves the problem.

If you only can provide the test program would also be valuable.

/Regards Kenneth (Erlang/OTP team at Ericsson)

On 6/27/07, Tony Rogvall <> wrote:
> Forget about this example, it was a bit hasty.
>
> The code in the emulator "looks" correct ...
>
> /Tony
>
>
> On 27 jun 2007, at 13.24, Tony Rogvall wrote:
>
> >
> > I have verified the bug!
> >
> > The following code crash (sometimes) with badarg on my Mac Dou Core
> > 2: (+S 10 -smp )
> >
> > (catch ets:delete(t)), ets:new(t, [public,named_table]), lists:foreach
> > (fun(I) -> spawn(fun() -> lists:foreach(fun(_) -> N=now(),
> > true=ets:insert_new(t, {N}) end, lists:seq(1,100000)) end) end,
> > lists:seq(1, 5)).
> >
> > =ERROR REPORT==== 27-Jun-2007::13:14:33 ===
> > Error in process <0.2192.0> with exit value: {badarg,[{ets,insert_new,
> > [t,{{1182,942873,172756}}]},{erl_eval,do_apply,5},{erl_eval,expr,5},
> > {lists,foreach,2}]}
> >
> >
> > /Tony
> >
> >
> >
> > On 27 jun 2007, at 06.35, Luke Gorrie wrote:
> >
> >> Howdy!
> >>
> >> I heard a rumour from a colleague that erlang:now() sometimes returns
> >> the same value twice on the SMP emulator. If that's the case then I
> >> suppose someone should change it back quicksmart :-)
> >>
> >>
> >> _______________________________________________
> >> erlang-questions mailing list
> >> 
> >> http://www.erlang.org/mailman/listinfo/erlang-questions
> >
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://www.erlang.org/mailman/listinfo/erlang-questions
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list