[Tutor] Connection/Analyis Order

Sean 'Shaleh' Perry shalehperry@attbi.com
Tue, 04 Jun 2002 07:51:31 -0700 (PDT)


> 
> I have never done any thread programming before (though Prog. Python
> makes it look easy enough), but I am concerned about different threads
> accessing the storage of the data at incompatible times and mucking it
> up and similar problems connecting to the mail server (I want to delete
> successfully analysed mails.)
> 
> Your advice is very welcome...
> 

The only reason to play with threads would be if you wanted to have a mail
parser thread and a mail retriever thread.  Reasonable, but not a requirement.

If you look at any of the comp sci books on threads one of the models discussed
is "producer/consumer" which is exactly what you describe.

The way it works is the producer thread does some work to produce data which is
stored in a common area.  The consumer eats one piece of data at a time.  This
could easily be done with python via a list accessible by both threads.  Have
the consumer eat from the front of the list and the producer add to the end.