|
Ralph Hempel wrote:
-- this needs to be atomic buffer[head] = "Some new data" head = head + 1 -- this needs to be atomic data = buffer[tail] buffer[tail] = nil tail = tail + 1 Is there a severe performance penalty for this? What happens when the index wraps around?
There is an interesting estimate in the PiL book. I don't remember the numbers, but the program would have to run for a *really* long time for wrap-around to happen.
In practice, it can be used safely in almost all applications. Enrico