process on windows!the alternative threading module for threads has no method equivalent to _thread exit()but since all that the latter does is raise system-exit exceptiondoing the same in threading has the same effect--the thread exits immediately and silentlyas in the following sort of code (see testexit-threading py in the example tree for this code)import threadingsystime def action()sys exit(print('not reached'or raise systemexit(threading thread(target=actionstart(time sleep( print('main exit'on related notekeep in mind that threads and processes have default lifespan modelswhich we explored earlier by way of reviewwhen child threads are still runningthe two thread modulesbehavior differs--programs on most platforms exit when the parent thread does under _threadbut not normally under threading unless children are made daemons when using processeschildren normally outlive their parent this different process behavior makes sense if you remember that threads are in-process function callsbut processes are more independent and autonomous when used wellexit status can be used to implement error detection and simple communication protocols in systems composed of command-line scripts but having said thati should underscore that most scripts do simply fall off the end of the source to exitand most thread functions simply returnexplicit exit calls are generally employed for exceptional conditions and in limited contexts only more typicallyprograms communicate with richer tools than integer exit codesthe next section shows how interprocess communication as we saw earlierwhen scripts spawn threads--tasks that run in parallel within the program--they can naturally communicate by changing and inspecting names and objects in shared global memory this includes both accessible variables and attributesas well as referenced mutable objects as we also sawsome care must be taken to use locks to synchronize access to shared items that can be updated concurrently stillthreads offer fairly straightforward communication modeland the queue module can make this nearly automatic for many programs things aren' quite as simple when scripts start child processes and independent programs that do not share memory in general if we limit the kinds of communications that can happen between programsmany options are availablemost of which we've parallel system tools