python, offlineimap and wakeups (outch)
Ethan Glasser-Camp
glasse at cs.rpi.edu
Wed Mar 9 18:14:45 GMT 2011
On 03/09/2011 06:39 AM, Sebastian Spaeth wrote:
> Some research revealed the a thread.join() will wake up often too see if
> our threads are still alive. And true, invoking offlineimap with the -1
> option makes the wakeups go down from 20 to 0.1 per second!
Can you elaborate? Attached please see a simple program that doesn't
seem to trigger wakeups at all (no output from "sudo powertop -d | grep
python").
I do see code in the threading.Condition.wait() method, which
sleeps/busy waits until it gets notified, with a comment that "if we
sleep the whole timeout time, we'll be unresponsive". But that only
happens if we join() with a timeout, and as far as I can tell, we don't
provide a timeout on any join() calls in offlineimap.
Anyhow, that comment raises the question: Responsive to what?
KeyboardInterrupt? You can try with the attached program, thread.join()
doesn't respond to KeyboardInterrupt either. If it really is
Thread.join, maybe we can subclass threading.Thread and define join in a
different manner.
Ethan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.py
Type: text/x-python
Size: 444 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110309/b4a892dd/attachment-0003.py>
More information about the OfflineIMAP-project
mailing list