- 论坛徽章:
- 11
|
本帖最后由 zylthinking 于 2017-03-31 11:22 编辑
回复 45# wlmqgzm
我看了一下说明, 没看实现, 如何理解 [size=13.3333px]single-writer/single-reader?[size=13.3333px]
[size=13.3333px]The [size=13.3333px]spsc_queue[size=13.3333px] class provides a single-writer/single-reader fifo queue, pushing and popping is wait-free.[size=13.3333px]
814 /** Pushes as many objects from the array t as there is space.
815 *
816 * \pre only one thread is allowed to push data to the spsc_queue
817 * \return number of pushed items
818 *
819 * \note Thread-safe and wait-free
820 */
821 size_type push(T const * t, size_type size)
822 {
823 return base_type::push(t, size);
824 }
852 /** Pops a maximum of size objects from ringbuffer.
853 *
854 * \pre only one thread is allowed to pop data to the spsc_queue
855 * \return number of popped items
856 *
857 * \note Thread-safe and wait-free
858 * */
859 size_type pop(T * ret, size_type size)
860 {
861 return base_type::pop(ret, size);
862 }
863
如果照字面意思, 那我觉得还是我的高明些; 我的好歹在 多写/一读 的情况下保证 wait_free
|
|