Grumpy Mike wrote:II know I can stop it with a control C but if I press any other key first, like the escape then control C doesn't work any more.
Ctrl+C clears any pending input and sends an interrupt signal to the current foreground process. It should not matter if you have typed other characters first. I can not reproduce any problem interrupting hello_triangle after pressing Esc.
The only ways I can see that your problem could have arisen are if you pressed Alt+left/right arrow keys or Alt+F1-F6 function keys while the demo was running. If you try these at the prompt you will see that they switch between six independent virtual consoles. With full-screen 3D or video running you would not be able to see this effect, but nevertheless Ctrl+C will only signal the right process when the correct console is selected.
Incidentally, for processes that ignore interrupt signals, there is a more abrupt option, Ctrl+\, which sends a quit signal. But you should only try this if Ctrl+C fails. Similarly, if you ever do need to kill processes from the command line you should start with plain "kill" and proceed to "kill -9" only as a last resort. The more abrupt methods give the process no chance to clean up before exiting.