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 Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: