Posted by: marceloaraujo | March 25, 2009

Python threads example

In last couple months, I looked better the Python features and some modules. Now, I can do some good things with pyGTK and I did some software to the company where I working. So, now I’m gonna improve some parts of this software and I gonna use threads to do some internals tasks.

Here is an example of how is easy to use and understand threads in Python. If you’ve interest to see this software, ask me and I can put in some place.

Software Result:

araujo@ponderosa thread> python thread.py
————————————————————————————–
Thread Name   |   Thread Id   |   Sleep   |      MESSAGE
————————————————————————————–
Thread-1                                        6                 Alive
Thread-2                                        6                 Alive
Thread-3                                        6                 Alive
Thread-4                                        3                 Alive
Thread-5               Special              5                 Alive
Thread-4                                        3                 Dead
Thread-5               Special              5                 Dead
Thread-8                                        2                 Alive
Thread-1                                        6                 Dead
Thread-2                                        6                 Dead
Thread-3                                        6                 Dead
Thread-8                                        2                 Dead


Leave a response

You must be logged in to post a comment.

Categories