A python polling loop (that continuously runs in order to check for events to happen, often in other threads) can hog the CPU (100% CPU). To prevent this and allow other processes to share the CPU put in a time.sleep(x) command, where x is a small number say 0.1 ms. This is sufficient to prevent the thread/loop from grabbing 100% CPU and setting off all your fans and heating up your cores.
Note that this is a bad way to do things in general, not least because sleep has a 10ms floor.
Note that this is a bad way to do things in general, not least because sleep has a 10ms floor.
Comments
Post a Comment