Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.116 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.83; '*S*': 0.06; 'subject:Python': 0.06; 'concurrently': 0.07; 'socket': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; 'concurrent': 0.16; 'gonna': 0.16; 'subject:threads': 0.16; 'wrote:': 0.18; 'module': 0.19; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'cc:no real name:2**0': 0.24; '>': 0.26; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'didnt': 0.31; 'pipe': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'module.': 0.36; 'doing': 0.36; 'tasks': 0.38; 'does': 0.39; 'how': 0.40; 'most': 0.60; "you've": 0.63; 'real': 0.63; 'to:addr:gmail.com': 0.65; 'cut': 0.74; 'cc:addr:yahoo.co.uk': 0.84; 'fired': 0.84; 'subject:know': 0.84; 'execution,': 0.91; 'subject:want': 0.91; 'choice.': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=561k0mJZ6MDxTRkby3UHJniu+IAgHKbJXeE6+FZqsLY=; b=G0hiH1YTkazYEOXr4lALdmlzxHCWHbU+A8wmlTfQPzKlKzrEQLJJgwzdQpXt8PP+H7 CkwD/N5XuthDtzC0vlUy3e86NGwDtu0A1wyTSl6rbrh5KaQz8DkMK/FBlUl2PhwZ5MOA etbX8BBxolFD+gEHRRQ+3cEnJlNUvsLr7rRMwRDMUSM+m6k5oWDR68WCYxERAtt/G8Yn qILST/p4s3+H6OUTIDgnabO/c/zYGZsrQm5wCp5VtRlKmyMCtNRT3Pvew7uB46/gXLUR AupXJi93Xjbkaq+4KYGmJ6Nfc6/xM3hOKpycEENe3wiXMlPb0JKnOFG10+J/h0FrAP/T tvBg== MIME-Version: 1.0 X-Received: by 10.49.26.198 with SMTP id n6mr34674764qeg.16.1369720943281; Mon, 27 May 2013 23:02:23 -0700 (PDT) In-Reply-To: References: Date: Tue, 28 May 2013 07:02:23 +0100 Subject: Re: I want to know how to implement concurrent threads in Python From: =?ISO-8859-1?Q?F=E1bio_Santos?= To: Daniel Gagliardi Content-Type: multipart/alternative; boundary=047d7b67730444295904ddc102bd Cc: Mark Lawrence , python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369720946 news.xs4all.nl 15865 [2001:888:2000:d::a6]:34293 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46257 --047d7b67730444295904ddc102bd Content-Type: text/plain; charset=ISO-8859-1 On 28 May 2013 05:06, "Daniel Gagliardi" wrote: > > fuck! fuck! i'm gonna be fired if i didnt get this shit! i told my boss id do it. fuck! im gonna pipe some crakc. fuck... So do it. You've already been told how to. It's true that python does not do real concurrent execution, but if most of your threads spend most time sleeping, waiting on a socket or doing IO, those are opportunities for other threads to cut in and execute concurrently and the threading module is your best choice. If you need to do cpu-intensive tasks concurrently, use the multiprocessing module. --047d7b67730444295904ddc102bd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On 28 May 2013 05:06, "Daniel Gagliardi" <danielgagliardiramos@gmail.com> wrote:=
>
> fuck! fuck! i'm gonna be fired if i didnt get this shit! i told my= boss id do it. fuck! im gonna pipe some crakc. fuck...

So do it. You've already been told how to.

It's true that python does not do real concurrent execut= ion, but if most of your threads spend most time sleeping, waiting on a soc= ket or doing IO, those are opportunities for other threads to cut in and ex= ecute concurrently and the threading module is your best choice.

If you need to do cpu-intensive tasks concurrently, use the = multiprocessing module.

--047d7b67730444295904ddc102bd--