> import threading > > def run_limited(time_limit, thr): > def runwrap(): > thr.daemon=True > thr.start() > thr.join(time_limit) > if thr.isAlive(): > print "Forzando salida" > > t=threading.Thread(target=runwrap) > t.start() > t.join() > > class NonStopThread(threading.Thread): > > def run(self): > > while True: > pass > > t=NonStopThread() > run_limited(10,t) > >
Funciona en python2.7 (al menos). Pero no en python2.4, que es lo que yo necesito. Mala suerte. En python 2.4 veo el mensaje "Forzando salida", pero la ejecucion no se detiene.
_______________________________________________ Python-es mailing list [email protected] http://mail.python.org/mailman/listinfo/python-es FAQ: http://python-es-faq.wikidot.com/
