How can I stop to exit main function? and Is infinite sleep consume many CPU usage?

0

Q1.Is it a good way adding "while&sleep" in order to avoid to exit main function like below?

main()
{
  run thread

  while(1)
    sleep(0xFFFFFFFF);
}

Q2. Are the two differ in terms of CPU perspective?

Case1)

while
  sleep(1);

Case2)

while
  sleep(0xFFFFFFFF);
infinite-loop
cpu-usage
thread-sleep
asked on Stack Overflow Feb 26, 2019 by Hercoa

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0