Errata: 15:30 Actually atomic increment/decrement operations are defined by the standard (however it might not be implemented on all platforms) so an example with any other operation, like adding or substracting a number larger than 1 would be more apt. 46:29 My answer here is not complete as read/write threads will also collide with other read/write threads over push/pop counts for the next data available/free slot Bonus: 51:02 The optimization trick I should have mentioned here is mapping a single physical memory region used for the buffer to 2 contiguous virtual memory regions in order to avoid wrapping logic
Errata:
15:30 Actually atomic increment/decrement operations are defined by the standard (however it might not be implemented on all platforms) so an example with any other operation, like adding or substracting a number larger than 1 would be more apt.
46:29 My answer here is not complete as read/write threads will also collide with other read/write threads over push/pop counts for the next data available/free slot
Bonus:
51:02 The optimization trick I should have mentioned here is mapping a single physical memory region used for the buffer to 2 contiguous virtual memory regions in order to avoid wrapping logic