I set up a producer thread that does nothing but generate boards and put them into a length-two Queue (blocking). At the rate that boards are pulled from the Queue, it's almost always full, but my poor consumer thread was still being blocked for "a long time" each time it fetched a board.
At this point I realized that q.get() on a full Queue immediately wakes up the producer, which has been blocked waiting to add a board to the Queue. It sets about generating the next board, and the consumer doesn't get to run again until the producer blocks again or is preempted.
The solution was simple: have the producer time.sleep(0.001) when q.put(board) returns.
Cheers,
Evan @ 4-am
-- http://mail.python.org/mailman/listinfo/python-list