Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52452
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'sys': 0.07; 'filename': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'terminates': 0.09; 'python': 0.11; 'def': 0.12; '2.7': 0.14; 'thread': 0.14; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'simplified': 0.16; 'subject:skip:m 10': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'import': 0.22; 'print': 0.22; 'header:User- Agent:1': 0.23; 'skip:" 30': 0.26; 'header:X-Complaints-To:1': 0.27; 'code': 0.31; 'file': 0.32; 'class': 0.32; 'run': 0.32; 'skip:# 10': 0.33; 'skip:t 40': 0.33; 'skip:_ 10': 0.34; 'could': 0.34; 'anybody': 0.35; 'but': 0.35; 'charset:us-ascii': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'email addr:gmail.com': 0.63; 'more': 0.64 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dave Angel <davea@davea.name> |
| Subject | Re: multithreading in python |
| Date | Tue, 13 Aug 2013 11:22:56 +0000 (UTC) |
| References | <dac9bb94-a1e2-410b-b925-445a2c8b66a0@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 174.32.174.30 |
| User-Agent | XPN/1.2.6 (Street Spirit ; Linux) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.530.1376392996.1251.python-list@python.org> (permalink) |
| Lines | 47 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1376392996 news.xs4all.nl 15995 [2001:888:2000:d::a6]:34427 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:52452 |
Show key headers only | View raw
samaneh.yahyapour@gmail.com wrote:
> hi
> my program work by 4 thread but when i use more thread it terminates
>
>
I simplified your code so anybody could run it, and tested it inside
Komodo IDE, on Python 2.7
#!/usr/bin/env python
import sys
import os
import time
import threading
class MyClass():
def __init__(self):
i = 0
while i<10:
work = WorkClass(i)
thread1 = threading.Thread(target=work.item_thread)
thread1.start()
i = i+1
time.sleep(0.01)
class WorkClass():
def __init__(self, parm):
self.parm = str(parm)
def item_thread(self):
print "beginning thread", self.parm
for filename in os.listdir("."):
data = "thread " + self.parm + " filename " + filename + "\n"
print data
time.sleep(0.5)
print "ENDDDDDDDDDDDDDDDDDDDDDDDDDDDD " + self.parm
x = MyClass()
print "Finishing main thread"
When the
--
Signature file not found
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
multithreading in python samaneh.yahyapour@gmail.com - 2013-08-13 01:06 -0700 Re: multithreading in python Steven D'Aprano <steve@pearwood.info> - 2013-08-13 08:38 +0000 Re: multithreading in python Dave Angel <davea@davea.name> - 2013-08-13 11:22 +0000 Re: multithreading in python Dave Angel <davea@davea.name> - 2013-08-13 11:40 +0000 Re: multithreading in python Terry Reedy <tjreedy@udel.edu> - 2013-08-13 11:51 -0400
csiph-web