Earlier quoted context omitted.
You're right. But sometimes, you can't afford the cost of the context switch.
but the proposed solution is literally trying to context switch in a loop
Ofcourse I'm open to even better solutions, but so far this is the best solution I know of.
I doubt that events/semaphores would work better, as they'd be implemented as spinlocks for short periods of time, in which case they wouldn't actually trigger a context switch. Once you use a long enough time to get to a context switch, it's probably going to be worse than doing the context switch explicitly, the way I do here.
All in all, it's a bug in Windows Aero, as the followup blog expained (not sure if it was ever fixed in later versions of Windows, I haven't been working with multiple display adapters/screens in situations like these in recent years): https://scalibq.wordpress.com/2012/03/28/the-story-of-micros...