rte_ring
关键点
无锁: rte_atomic32_cmpset 直到成功(CAS)
环: 总长度count应该是2的倍数,
求剩余空间: mask + tail - head(其中mask等于count-1)。(The subtraction is done between two unsigned 32bits value (the result is always modulo 32 bits even if we have prod_head > cons_tail). So 'free_entries' is always between 0 and size(ring)-1.)
网友评论