Keeping a function from taking to long--threads?

brandon.mcginty at gmail.com brandon.mcginty at gmail.com
Mon Mar 20 02:15:34 CET 2006


Thanks, however, I forgot to mention that I'm using windows, and from what
I've tried, the setdefaulttimeout function doesn't work on my machine.
Again, thanks for your help!
Brandon McGinty


> -----Original Message-----
> From: 
> python-list-bounces+brandon.mcginty=gmail.com at python.org 
> [mailto:python-list-bounces+brandon.mcginty=gmail.com at python.o
> rg] On Behalf Of Rene Pijlman
> Sent: Sunday, March 19, 2006 5:33 PM
> To: python-list at python.org
> Subject: Re: Keeping a function from taking to long--threads?
> 
> 
> <brandon.mcginty at gmail.com>:
> >Just wondering if anyone knows of a way to keep a function,
> >E.g. socket.gethostbyaddr("12.34.56.78"),
> >>From taking to long-if it's run for more than 1 second, the function
> >gethostbyaddr will be terminated?
> 
> import socket
> socket.setdefaulttimeout(1)
> 
> -- 
> René Pijlman
> 
> Wat wil jij leren?  http://www.leren.nl
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.385 / Virus Database: 268.2.5/284 - Release 
> Date: 3/17/2006
>  
> 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.2.5/284 - Release Date: 3/17/2006
 




More information about the Python-list mailing list