Qun Cao:

> import thread
> def main():
>     thread.start_new(test.())
> 
> def test():
>     print 'hello'
> 
> main()
> "
> this program doesn't print out 'hello' as it is supposed to do.
> while if I change main()

    The program has exited before the thread has managed to run. It is 
undefined behaviour whether secondary threads survive main thread 
termination but it looks like they don't on your system.

    Use the threading module and call join to wait for all threads to 
complete before exiting the program.

    Neil
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to