[Tutor] Good threading tutorial

Shawhan, Doug (EM, ITS) Doug.Shawhan at ge.com
Wed Mar 31 13:54:26 EST 2004

How about a nice "hello threads" example? :-)

-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org]On
Behalf Of R. Alan Monroe
Sent: Wednesday, March 31, 2004 12:57 PM
To: tutor at python.org
Subject: Re: [Tutor] Good threading tutorial

> 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.


Tutor maillist  -  Tutor at python.org

More information about the Tutor mailing list