4 ms·
For me luckily the guy who had wrote the whole thing had wrapped the set and wait part. So I could put in a lock in there to mitigate the race condition. I al
by sumtechguy 5y ago
For me luckily the guy who had wrote the whole thing had wrapped the set and wait part. So I could put in a lock in there to mitigate the race condition. I also yanked out using the windows message passing parts and used a shared memory space (memory was tight and the timing was unfortunately critical, but I could mitigate it by blocking if the memory space was full, not great but it worked). I have used peekmessage many times but I usually use it with some sort of sleep condition. It gives a weird kind of 'janky' feel to the application but in some cases it works fine. These days I would use a proper message passing queue system and a thread instead of trying to hijack the windows ones. It is the 'wait' functions that are the culprit. They basically only wait once you call them. Anything outside of that, your problem and you end up wrapping the things in locks to get it to work right as the 'wait function' is basically a shared resource in windows world.