scheduler or infinite loop

Frank Millman frank at chagford.com
Thu Sep 30 01:01:14 EDT 2010


harryos wrote
>>
>> Here is a technique that allows the loop to run in the background, in its
>> own thread, leaving the main program to do other processing -
>>
>> import threading
>>
>> class DataGetter(threading.Thread):
>>

> thanks Frank

A pleasure.

I left out a line that will usually be desirable.

At the end of the program, you should have -

    data_getter.stop()
+   data_getter.join()

This forces the main program to wait until the thread has terminated before 
continuing.

Frank





More information about the Python-list mailing list