rigtorp / MPMCQueue

A bounded multi-producer multi-consumer concurrent queue written in C++11
MIT License
1.15k stars 159 forks source link

Feature request: is LIFO possible? #5

Closed emmenlau closed 5 years ago

emmenlau commented 6 years ago

This is a very nice MPMC queue! Is it possible to add LIFO functionality? It looks as if pop() could be modified to use head_.fetch_sub(1) but I am uncertain if this breaks something?

rigtorp commented 6 years ago

Someone else asked about this recently.

I believe it's possible, but needs some changes that would reduce throughput for FIFO case. So would be best to create separate class for this.

On Fri, Feb 2, 2018, 10:01 Mario Emmenlauer notifications@github.com wrote:

This is a very nice MPMC queue! Is it possible to add LIFO functionality? It looks as if pop() could be modified to use head_.fetch_sub(1) but I am uncertain if this breaks something?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rigtorp/MPMCQueue/issues/5, or mute the thread https://github.com/notifications/unsubscribe-auth/AAK3a0xJITyhRDUFeZNfw3QZ_0eWmtIUks5tQyUfgaJpZM4R3UTy .

emmenlau commented 6 years ago

Could you help to implement this? Your experience in this topic would be great.