Google Groups Home
Help | Sign in
Message from discussion Ukončení zaneprázdněného threadu
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Jakub Lužný  
View profile
 More options Apr 24, 12:32 pm
Newsgroups: cz.comp.lang.python
From: "Jakub Lužný" <limot...@gmail.com>
Date: Thu, 24 Apr 2008 18:32:51 +0200
Local: Thurs, Apr 24 2008 12:32 pm
Subject: [python] Ukončení zaneprázdněného threadu
Zdarec :-)

Vytvořím vedlejší thread pomocí modulu threading a dám mu za úkol čekat.
Spustím ho, a v hlavním threadu dám pořád dokola něco vypisovat. Když potom
ale dám KeyboardInterrupt, tak se hlavní thread ukončí, ale vedlejší zůstane
viset na tom čekání. Je nějakej způsob, jak thread ukončit i s tím čekáním?

#!/usr/bin/env python
import threading

def thread1():
        while(1):
                čekej_do_nekonečna()

t1 = threading.Thread(target = thread1)
t1.start()

while(1):
        print "blbnu :)"


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google