Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5096

Re: NewBie Doubt in Python Thread Programming

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prologic@shortcircuit.net.au>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.04; 'wed,': 0.04; 'see:': 0.07; 'received:209.85.160.174': 0.09; 'received:mail-gy0-f174.google.com': 0.09; 'to:name:python list': 0.09; 'pm,': 0.11; 'result.': 0.14; 'wrote:': 0.14; 'concepts.': 0.16; 'pydoc': 0.16; 'subject:Programming': 0.16; 'subject:Thread': 0.16; 'terminate.': 0.16; 'terminates': 0.16; 'terminating': 0.16; 'thread?': 0.16; 'header:In-Reply-To:1': 0.22; 'loop': 0.22; 'message-id:@mail.gmail.com': 0.28; 'received:209.85.160': 0.28; 'seem': 0.30; 'normal.': 0.31; 'solved': 0.31; 'threads': 0.31; 'does': 0.31; 'to:addr:python- list': 0.32; 'execution': 0.33; 'difference': 0.35; 'there': 0.35; 'flag': 0.35; 'usually': 0.36; 'some': 0.37; 'received:209.85': 0.37; 'execute': 0.38; 'thread': 0.38; 'received:google.com': 0.38; 'active': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'how': 0.39; 'stopped': 0.40; 'header:Received:5': 0.40; 'skip:h 20': 0.60; 'give': 0.61; '2011': 0.62; '11,': 0.77
MIME-Version 1.0
In-Reply-To <BANLkTikr8fu1sDrfu2a-wyEN_KpVVNCdew@mail.gmail.com>
References <BANLkTikr8fu1sDrfu2a-wyEN_KpVVNCdew@mail.gmail.com>
From James Mills <prologic@shortcircuit.net.au>
Date Wed, 11 May 2011 17:34:10 +1000
Subject Re: NewBie Doubt in Python Thread Programming
To python list <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1395.1305099273.9059.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 82.94.164.166
X-Trace 1305099273 news.xs4all.nl 81482 [::ffff:82.94.164.166]:48680
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:5096

Show key headers only | View raw


On Wed, May 11, 2011 at 4:57 PM, vijay swaminathan <swavijay@gmail.com> wrote:

[...]

> 1. How the total active thread is 2?

Your threads are terminating as normal.
Without some kind of loop in your run() method
they will execute the instructions and terminate.

> 2. how do I stop a thread? does it get automatically stopped after execution

Usually by a flag or condition that terminates your run() function/method.

> 3. Am I totally wrong in understanding the concepts.
> 4. what is the difference between active_count() and activeCount() since
> both seem to give the same result.

They are synonyms.

> 5. is there a way to find out if the thread is still active or dead?

See: pydoc threading.Thread or help(threading.Thread)

cheers
James

-- 
-- James Mills
--
-- "Problems are solved by method"

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: NewBie Doubt in Python Thread Programming James Mills <prologic@shortcircuit.net.au> - 2011-05-11 17:34 +1000

csiph-web