use threading without classes

Harlin Seritt harlinseritt at yahoo.com
Wed Aug 31 07:04:29 EDT 2005


Is there any reason why you wouldn't want to do this using the the
threading class? To each his own I suppose. You can try the following
though you'll at least need to use functions:


import time
import thread

def myfunction(string,sleeptime,*args):
    while 1:

        print string
        time.sleep(sleeptime) #sleep for a specified amount of time.

if __name__=="__main__":

    thread.start_new_thread(myfunction,("Thread No:1",2))

    while 1:pass




More information about the Python-list mailing list