[ = [ = [ = [ = [ = [ = [ = [ = [ = [ = [ = [ = [ = [ = main thread exiting of coursethreads are for much more than counting we'll put shared global data to more practical use in "adding user interfaceon page where it will serve as completion signals from child processing threads transferring data over network to main thread controlling tkinter gui displayand again later in ' threadtools and ' pymailgui to post results of email operations to gui (watch for "previewguis and threadson page for more pointers on this topicglobal data shared among threads also turns out to be the basis of queueswhich are discussed later in this each thread gets or puts data using the same shared queue object the threading module the python standard library comes with two thread modules_threadthe basic lowerlevel interface illustrated thus farand threadinga higher-level interface based on objects and classes the threading module internally uses the _thread module to implement objects that represent threads and common synchronization tools it is loosely based on subset of the java language' threading modelbut it differs in ways that only java programmers would notice |example - morphs our counting threads example again to demonstrate this new module' interfaces example - pp \system\threads\thread-classes py ""thread class instances with state and run(for thread' actionuses higher-level java-like threading module object join method (not mutexes or shared global varsto know when threads are done in main parent threadsee library manual for more details on threading""import threading |but in case this means youpython' lock and condition variables are distinct objectsnot something inherent in all objectsand python' thread class doesn' have all the features of java' see python' library manual for further details threads