[Tutor] Good threading tutorial

R. Alan Monroe amonroe at columbus.rr.com
Wed Mar 31 13:57:28 EST 2004

> I have googled up a few examples of threading in python. I am still
> a little unclear on the concept. Are there any good hand-holding
> threading tutorials around?

>From what little I've played with it:

- def a function that you want to get executed in a subthread
- create a new thread, feed it the name of the function above
- start the new thread

at this point, you need not execute any further statements in your
program. The main program will wait indefinitely for the child thread
to complete. Once it's done, the main program will exit too. It's kind
of neat to watch, the first time you try it.

I haven't reached the level of locking or semaphores, myself.


More information about the Tutor mailing list