Using nntplib

Steve Holden sholden at holdenweb.com
Fri May 31 05:18:28 EDT 2002


"jb" <jblazi at hotmail.com> wrote ...
> Steve Holden wrote:
> >     http://pydish.holdenweb.com/pwp/chp5notes.htm
> >
> > As far as informing the GUI thread about what's been received so far,
> > whether you use LIST or XOVER perhaps you could just put the headers
onto
> > a Queue (see that Queue module) and letting the GUI thread take them
off.
> > That should ease up any critical-section issues.
>
> Thx, this sounds intresting. But I should have to change nntplib, should I
> not? That I should use queues, is obvious. Should I insert enqueueing (?)
> at the position I marked in my first posting?
>
Well I'm not sure why you think nntplib changes would be required. Perhaps I
didn't explain myself clearly. You were suggesting having a GUI thread and a
"worker" thread (if I understood you). I was simply saying that the worker
thread could use XOVER to find out what messages are available, and then
retrieve them (using the standard nntplib features) and queue them for the
GUI thread to display. The sample code I referenced shows how, with no
nntplib changes. Clearly the messages would need to be available to other
worker threads as well.

> Maybe the best solution would be to use QSockets (as I work with PyQt).
Then
> I can use Qt signaling in a very natural way. I could create a new,
> asynchronous version of nntplib, that works with Qt signals (and this
seems
> easy as nntplib is nicely documented and clear). What do you think of
this?
>
I couldn't say, having hardly touched Qt. I was suggesting using the Queue
module, a thread-safe way of passing data between threads. Then, as someone
else suggested, your GUI and your worker threads don't interfere with each
other.

the-rest-is-up-to-youly y'rs  - steve--
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------








More information about the Python-list mailing list