sleep CPU usage + threads

I have a daemon thread running that gathers info into structs, and then another regular thread that dumps the structs to file every 5 minutes. For the second thread i was just  doing something like this:



Just wondering if this will hog the CPU more than one would think.

Who is Participating?
rmharwoodConnect With a Mentor Commented:
Nope, a sleeping process/thread does not use any CPU.
sleep() is fine in a thread. It'll stop the whole thread from being scheduled until the time expires.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.