Open tballmsft opened 4 years ago
On both the Arcade simulator and hardware, I code the following
However, sometimes the REPEAT events keep coming, even though I have release the left-arrow key.
I have traced this problem down to an inversion of handlers. In both the browser and Arcade devices, the act of holding down the left-button continuously generates KEY_DOWN events. What I am seeing in the trace though is the following
The important part is the inversion of handler invocation that happens (this is the race condition): the KEY_UP handler is invoked before the KEY_DOWN handler even though the KEY_UP event occurred after the KEY_DOWN event – the result is that controller logic keeps generating KEY_REPEAT events, as the last event received was KEY_DOWN.
The usual and correct trace is:
Each handler is execute by a different fiber. Given sequential code that spawns two threads, P and Q, in sequence, it certainly seems like it should be possible for the code of Q to start executing before that of P. Is the same thing possible with fibers?
Sometimes when I am using the game simulator with the keyboard (specifically, the arrow keys) and doing a lot of quick keystrokes (say for moving a character), one (or sometimes two) of the keys will start repeating even though I am not pressing the keys. This happens non-deterministically and basically destroys game play. The only recourse is to restart the game simulator.