3 ms·
There’s a paragraph in the article about this. “The single producer and single consumer didn’t require locks nor atomic accesses to the storage array since the
by dahart 4y ago
There’s a paragraph in the article about this.
“The single producer and single consumer didn’t require locks nor atomic accesses to the storage array since the queue guaranteed that accesses at the specified index were not concurrent. However, this is not the case with multiple-consumers. Consumers race when popping. The loser’s access might occur after the winner’s commit, making its access concurrent with the producer. Both producer and consumers must account for this.”
- Matthias247 4y agoYes, I read that one, but still didn't understand what will change in code generation due to it. If it's about the read on the consumer side not being reordered after the commit, then I assumed the release on the atomic will take care of it. Maybe I'll throw it into godbolt later on to figure out.