Re: CPython thread starvation

2012-04-28 Thread Danyel Lawson
Sprinkle time.sleep(0) liberally throughout your code where you think natural processing breaks should be. Even in while loops. It's lame but is the only way to make Python multithreading task switch fairly. Your compute intensive tasks need a time.sleep(0) in their loops. This prevents starvation

Re: CPython thread starvation

2012-04-28 Thread Danyel Lawson
I'm glad I thought of it. ;) But the trick is to use port 5353 and set a really short timeout on responses in the config for the DNS cache. On Sat, Apr 28, 2012 at 10:15 AM, Chris Angelico wrote: > On Sat, Apr 28, 2012 at 11:46 PM, Danyel Lawson > wrote: >> The DNS looku

Re: Problem with time.time() standing still

2012-05-05 Thread Danyel Lawson
Add a time.sleep(0) call to all your loops. Multithreading in Python is a cooperative cross platform threading simulation if you have tight loops Python won't task switch until you make a system call. Potentially preventing internal library variables from being updated. Your five minute interval m