Understanding threading

Viewed 687

Trying to get my head around threading. In my code, it's only firing one thread, when I think it should go straight on to the second. I've been reading about locks and allocating but don't quite understand. What would I need to do here to let 2 threads run independently at the same time?

import thread

def myproc(item):
    print("Thread fired for " + item)
    while True:
        pass

things = ['thingone', 'thingtwo']

for thing in things:
    try:
        thread.start_new_thread(myproc(thing))

    except:
        print("Error")
2 Answers
Related