hzeller/rpi-rgb-led-matrix

[Q&A] SwapOnVSync can lose order when using multithreading?

Opened this issue · 2 comments

Basically the condition wait becomes multi producer to single consumer. I am not sure this works the way you intend. This represents another type of priority inversion in terms of processing order. If one thread gets more time a frame can skip ahead or cause a frame drop. You use async logic without control logic.

Note there is a work around on the application side for this. So maybe document and close.

Frames are emitted in the same order you call SwapOnVSync(), so if you feed from multiple threads and have a particular order in mind you need to order your calls to SwapOnVSync(), which is intended.