[Tutor] setting up a timer

Lloyd Kvam pythontutor@venix.com
Tue, 02 Jul 2002 17:10:36 -0400


Thanks, Danny.

Danny Yoo wrote:

> 
> On Tue, 2 Jul 2002, Lloyd Kvam wrote:
> 
> 
>>I have some logic for starting and connecting to a MySQL database that I
>>believe could get stuck because of network problems or remote server
>>problems.  I'd like to have a timer to simply cancel the process if it
>>is not successful in a reasonable time frame.  My search didn't turn up
>>any examples, so I coded the following (my unix/C roots are showing).
>>
>>Then I discovered that signal.alarm is NOT available in Windows.  Mark
>>Hammond's book (Python Programming on Win32) was no help.
>>
>>Please point me in the right direction.
>>
> 
> Hi Lloyd!
> 
> There's a "Timer" class in the threading module that might be useful: it
> uses threads underneath, so it should be usable with Windows:
> 
>     http://python.org/doc/current/lib/timer-objects.html
> 
> 
> Hope this helps!
> 
> 
> 


-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice: 
603-443-6155
fax: 
801-459-9582