wierd threading behavior

Sam Pointon free.condiments at gmail.com
Sat Oct 15 01:20:55 CEST 2005


thread is a low-level threading module, and start_new is deprecated.
Aside from that, thread.start_new(test.()) is syntaxically wrong (a
pair of brackets can't follow a dot). However, your example does work
for me once I fix the syntax, and it prints hello but then hangs. I
can't explain the other results, though - possibly undefined behaviour
or more likely me not having much experience with the low-level thread
interface.

Use threading instead, like so:

import threading

def test():
    print 'Test successful!'

def main():
    thread = threading.Thread(target = test)
    thread.start()

main()




More information about the Python-list mailing list