[erlang-questions] Lockfree now()

Wojtek Narczyński <>
Thu Jul 12 19:08:28 CEST 2012


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.

It can be implemented with N-bit CAS for N-bit time value.

--Regards,
Wojtek Narczynski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120712/a45a7fa1/attachment.html>


More information about the erlang-questions mailing list