[erlang-questions] Lockfree now()

Erik Søe Sørensen eriksoe@REDACTED
Thu Jul 12 19:27:33 CEST 2012


2012/7/12 Wojtek Narczyński <wojtek@REDACTED>

>  On 07/12/2012 02:58 PM, Erik Søe Sørensen wrote:
>
> When I implemented now() in Erjang, I found a lock-free algorithm for it
> which has the right "timestamp must be monotonically increasing" property.
>
>
> http://www.erlang.org/doc/man/erlang.html#now-0
> " It is also guaranteed that subsequent calls to this BIF returns
> continuously increasing values."
>
> I don't think your solution quarrantees this.
>
Why not? That's certainly the intention of the last part; latest_now should
always be updated in a increasing manner, and the return value of
ensure_monotonically_increasing_now() should always be equal to the new
value of latest_now.
Did I make a mistake?


>
> It can be implemented with N-bit CAS for N-bit time value.
>
> --Regards,
> Wojtek Narczynski
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120712/a35fe041/attachment.htm>


More information about the erlang-questions mailing list