logoalt Hacker News

dalvrosatoday at 2:22 PM1 replyview on HN

Sorry, but that's not actually true. There are no data races, the atomics prevent that (note that there are only one consumer and one producer)

Regarding the style, it follows the "almost always auto" idea from Herb Sutter


Replies

secondcomingtoday at 2:42 PM

If you enforce that the buffer size is a power of 2 you just use a mask to do the

    if (next_head == buffer.size())
        next_head = 0;
part
show 3 replies