Hi all,

I've seen quite a few posts about threading problems in
this group and am surprised to see that nobody recommended
cooperative threading using generators. See
http://www.daa.com.au/pipermail/pygtk/2001-October/002056.html
and
http://www-106.ibm.com/developerworks/linux/library/l-pythrd.html

Advantages:
* Guaranteed to work regardless of underlying thread support
* Much simpler to code and debug, no need for locks, semaphores etc.
* Allows extremely efficient scheduling. Thread creation/deletion
  overhead is minimal.

Disadvantages:
* Potentially long running or blocking operations (file.read etc)
  need to be handled with care.

The flexible scheduling is especially useful. In my MDI app I
have a fifo queue for each document and the scheduler runs the
queue for the currently focused document before any others.

Stephen.
-- 
Stephen Kennedy <[EMAIL PROTECTED]>
http://meld.sf.net visual diff and merge

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to