Python and threads

vedrandekovic at yahoo.com vedrandekovic at yahoo.com
Sun Jan 18 11:09:02 EST 2009


Hello again,

Thanks for previous help on "Start two threads in same time" it was
useful,but when I run this
two threads, I think they don't start at the same time, here is my
code snippet:


import threading

class ThreadedClass1(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)

    def run(self):
        a=True
        while a==True:
            bm=my_module.MyClass()
            a=bm.get_Python_Process_Usage_Function()   #Returns True
or False

class ThreadedClass2(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)

    def run(self):
        os.popen("my_python_script.py")



threaded_obj = ThreadedClass1()
threaded_obj.start()
threaded_obj2 = ThreadedClass2()
threaded_obj2.start()

Regards,
John



More information about the Python-list mailing list