get_key() in an infinite loop

new topic     » topic index » view thread      » older message » newer message

Hi Guys,

I'm using a program which uses get_key() in an infinite loop (and exits when the code is 'q'). I'm wondering if there's anyway I can make this less CPU intensive (I'm using the program on a laptop) by using one of the multi-tasking routines. Reading through the multi-tasking section in the manual leads me to believe something could be done. If the loop polls the keyboard every 0.1 secs it should be enough, I think I might need to create a sort of 'dummy' task (which does nothing, but is not another infinite loop!) so that time is split between this and the loop which does the work, I'm just not sure how to implement it. Can anyone suggest some code?

Thanks in advance!

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu