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


Groups > comp.lang.python > #11338

thread and process

Return-Path <1248283536@qq.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.029
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'else:': 0.03; 'subject:process': 0.07; 'output': 0.10; 'threading': 0.16; 'to:name:python-list': 0.18; 'ret': 0.23; 'skip:" 30': 0.28; 'import': 0.28; 'print': 0.29; 'parent': 0.30; 'to:addr:python- list': 0.33; 'skip:" 10': 0.36; 'two': 0.37; 'skip:& 20': 0.38; 'skip:- 10': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'here': 0.65; 'strange': 0.68
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s0907; t=1313226596; bh=8TqQSWCsz1eVc+y1OC8ojsdxkGBN1qHo4p3AblcWWGI=; h=X-QQ-SSF:X-QQ-BUSINESS-ORIGIN:X-Originating-IP:X-QQ-STYLE: X-QQ-mid:From:To:Subject:Mime-Version:Content-Type: Content-Transfer-Encoding:Date:X-Priority:Message-ID:X-QQ-MIME: X-Mailer:X-QQ-Mailer; b=g/fBlNY15qrC6waUq46dA7Fx2ygGM2Znfj7EBctv2X3XivzGfaM3aTb9TwKSKmHzB 8sjqn8paFQutWKzgC8QJmaidetFv7OXjFFJzk97bzL25DqfG2I5DZQ8/e8juxpt
X-QQ-SSF 00000000000000F0000000000000000
X-QQ-BUSINESS-ORIGIN 2
X-Originating-IP 119.123.0.25
X-QQ-STYLE
X-QQ-mid webmail18t1313226595t1928316
From "守株待兔" <1248283536@qq.com>
To "python-list" <python-list@python.org>
Subject thread and process
Mime-Version 1.0
Content-Type multipart/alternative; boundary="----=_NextPart_4E463F63_DF4A2BE8_280B2552"
Content-Transfer-Encoding 8Bit
Date Sat, 13 Aug 2011 17:09:55 +0800
X-Priority 3
X-QQ-MIME TCMime 1.0 by Tencent
X-Mailer QQMail 2.x
X-QQ-Mailer QQMail 2.x
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.2251.1313226603.1164.python-list@python.org> (permalink)
Lines 59
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1313226603 news.xs4all.nl 23922 [2001:888:2000:d::a6]:48016
X-Complaints-To abuse@xs4all.nl
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!usenetcore.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:11338

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

please see my code:
import os
import  threading
print  threading.currentThread()  
print "i am parent ",os.getpid()
ret  =  os.fork()
print  "i am here",os.getpid()
print  threading.currentThread()
if  ret  ==  0:
         print  threading.currentThread()
else:
        os.wait()
        print  threading.currentThread()
        
        
print "i am runing,who am i? ",os.getpid(),threading.currentThread()

the output is:
<_MainThread(MainThread, started -1216477504)>
i am parent  13495
i am here 13495
<_MainThread(MainThread, started -1216477504)>
i am here 13496
<_MainThread(MainThread, started -1216477504)>
<_MainThread(MainThread, started -1216477504)>
i am runing,who am i?  13496 <_MainThread(MainThread, started -1216477504)>
<_MainThread(MainThread, started -1216477504)>
i am runing,who am i?  13495 <_MainThread(MainThread, started -1216477504)>
it is so strange that  two  different  processes  use one  mainthread!!

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


Thread

thread and process "守株待兔" <1248283536@qq.com> - 2011-08-13 17:09 +0800
  Re: thread and process aspineux <aspineux@gmail.com> - 2011-08-13 03:01 -0700
  Re: thread and process Carl Banks <pavlovevidence@gmail.com> - 2011-08-13 03:52 -0700

csiph-web