Hi All, I'm new bie to thread programming and I need some assistance in understanding few concepts ...
I have a very simple program which runs a thread and prints a string. import threading class MyThread(threading.Thread): def __init__(self, parent = None): threading.Thread.__init__(self) def run(self): print 'Hello World' def main(): for i in range(10): MyThread_Object = MyThread() print 'Object id is : ' , id(MyThread_Object) print 'Staring thread ----------> ' , MyThread_Object.getName() MyThread_Object.start() count = threading.activeCount() print 'The active thread count is: ' , count if __name__ == '__main__': main() When I run this, I could see 10 thread being called. But when I print the active thread count it is only 2. Need some understanding on the following. 1. How the total active thread is 2? 2. how do I stop a thread? does it get automatically stopped after execution ? 3. Am I totally wrong in understanding the concepts. 4. what is the difference between active_count() and activeCount() since both seem to give the same result. 5. is there a way to find out if the thread is still active or dead? Please help me in understanding .. -- Vijay Swaminathan
-- http://mail.python.org/mailman/listinfo/python-list