Hello, I'm experienced in C but relatively new to linux programming. But it's nice and quick to use GCC. I'm writing a couple of utilities and they use the pattern below to perform some periodic behavior.
It works fine but according to the system monitor the CPU % is pretty high. So I have to ask Linux experts -- is this bad practice? Is there some Linux OS call I should make to cede control back to the operating system for a specific amount of time?
What I'm interested in is the capital-R "Right" way to do this, from the true Linux gurus.
OR ... to get affirmation that this practice is okay... less work for me. :)
Thanks for any help.
int counter = 0;
// initialize code
// do something periodic