Closed nunojpg closed 4 years ago
The difference between AtomicQueue
and OptimistAtomicQueue
is that
AtomicQueue
uses try_push
/try_pop
which return false
when the queue is full/empty. OptimistAtomicQueue
uses push
/pop
which busy wait when the queue is full/empty.You have that well explained in the README.
So maybe the confusion is that that API only exists for those versions? I.e. AtomicQueue does not have push/pop, and OptimisticAtomicQueue does not have try_*?
Because from the documentation I understood both version have all the 4 methods.
Because from the documentation I understood both version have all the 4 methods.
You are right, AtomicQueue
class provides both versions, with and without try_
. It is the usage that determines whether the queue is used in optimistic fashion, there is no OptimistAtomicQueue
class. In some cases you may want push
and try_pop
, i.e. optimistic producer, but pessimistic consumer.
Ok, thanks!
Something unclear to me while reading the README and also peeking at the code. So considering:
What does AtomicQueue do when empty or full?