[IronPython] A Multithreaded Question

Rob Oakes rob.s.oakes at gmail.com
Tue Dec 2 05:01:47 CET 2008

Dear Group,


For the past several weeks, I have been trying to wrap my head around the
different classes available in System.Threads.  While I feel that I have a
good handle on the "BackgroundWorker" class, I without doubt have a very
long way to go on the others.  With that said, I have a bit of an
architectural question.  I have been working on a multithreaded  download
manager for a small podcast player (written primarily to start teaching
myself Python).  I've written about the details of the download manager at:




Very briefly, it uses a C# wrapper to interact with the Background
Intelligent Transfer Service (BITS).  Details about the C# wrapper code can
be found at:




While I have a very rough prototype that works, I'm not sure what the best
way to have it update a progress bar is.  At present, I have created a
BackgroundWorker that sets the ProgressBar.Value whenever something changes.
As this is nearly constant, it seems as though the thread doing the updates
queries the BitsJob hundreds or thousands of times a second.  This seems
unnecessary and kills the responsiveness of the program.  I fixed this
(kindof) by putting the thread doing the query to sleep for 200 ms (via
Thread.Sleep(200)).  While this increases the responsiveness of the program,
it feels like a hack.  Are there any other strategies that I could pursue?




Rob Oakes

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3655 (20081201) __________

The message was checked by ESET NOD32 Antivirus.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081201/52a2b6ea/attachment.html>

More information about the Ironpython-users mailing list