Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: [python] Ukončení zaneprázdněného thread u

0 views
Skip to first unread message

azurIt

unread,
Apr 24, 2008, 12:52:05 PM4/24/08
to pyt...@py.cz
bohuzial nie je, teda o ziadnom neviem. urob nieco taketo (treba tam ale este osetrit ten KeyboardInterrupt - odporucam pozriet sa na modul signal ):

#!/usr/bin/env python
import threading

koniec = False

def thread1():
while not koniec:
čekej_do_nekonečna()

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

while(1):
print "blbnu :)"

koniec = True


>-----Pôvodná správa-----
>Od: Jakub Lužn [mailto:limo...@gmail.com]
>Komu: pyt...@py.cz
>Predmet: [python] Ukončení zaneprázdněného thread u
>
>
>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 :)"
>_______________________________________________
>Python mailing list
>Pyt...@py.cz
>http://www.py.cz/mailman/listinfo/python

Jakub Lužný

unread,
Apr 24, 2008, 12:57:12 PM4/24/08
to Konference PyCZ
Tohle mi moc nepomůže, jde mi o to, jak odstřelit tu čekající funkci.

Dne Thursday 24. April. 2008 18:52:05 azurIt napsal(a):

signature.asc
0 new messages