Well, putting a wait before swapping buffers can end up halving the frame rate if you often miss a retrace during the wait. This really is a nasty bug. It’s actually disappointing to find out it’s a driver bug since there’s nothing I can do about it :(~~~~~
On another note, I would suggest considering this as a replacement for the SDL event queue: http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4625874
It’s an array-based FIFO that handles multiple concurrent reader and writer threads. CAS-based version is in Fig.5 (uses CAS to emulate LL/SC). It looks like it’s wait-free in most circumstances (the while loops should do very few iterations). The downside is it only got published in September so we’ll see if someone might not find a bug in that algorithm.