From: Jay Link (jlink@ilbbs.com)
Date: Wed 26 Dec 2001 - 19:07:01 IST
> I have a question about cpu usage.. > in main loop I use; > void mainloop(void) > { > int key; > while ( (key = vga_getkey()) != 27) > { > } > } > but like this, cpu usage raises up to %90 vga_getkey() is non-blocking, so it's going to keep looping until a value of 27 is received. You might consider inserting a delay -- maybe something as small as usleep(200000) -- which will slow down your process, but not so much as to impede input. I believe(?) that even if input is received during the pause, it will go into a buffer and vga_getkey() will read from that, so nothing will be lost. Matan? Sergio? Finally, I assume you know about the vlocking call vga_getch(), and would use that if possible. Best, -JL ------------------------------------------------------------------ Unsubscribe: To: listbot@svgalib.org Body: unsubscribe linux-svgalib
This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:24 IST