473,320 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Timer hangs when quitting app

Hello,

I'm trying to create an application that needs a Timer() to do various
checks.
My class has a self.timer = Timer(900, self.sendDNSRequest)
The timer itself works fine but whenever I try to exit the application, it
simply hangs and I have to kill the proces using `kill pid`

I have tried uncommenting the timer stuff, and then the app works as
expected.

Is there anything I need to do to kill the timer?
I have tried to create a __del__(self) function in my app. It gets called
when I leave out the timer, but with the timer enabled, it never gets
called.

Any hint will be appreciated :-)

Greetings,
Gitte Wange
Jul 18 '05 #1
1 1454
Gitte Wange wrote:
I'm trying to create an application that needs a Timer() to do various
checks.
My class has a self.timer = Timer(900, self.sendDNSRequest)
The timer itself works fine but whenever I try to exit the application, it
simply hangs and I have to kill the proces using `kill pid`

I have tried uncommenting the timer stuff, and then the app works as
expected.

Is there anything I need to do to kill the timer?
I have tried to create a __del__(self) function in my app. It gets called
when I leave out the timer, but with the timer enabled, it never gets
called.


A Timer is a subclass of threading.Thread, which means
you can do "self.timer.setDaemon(True)" on it *before*
you start it, and it will not hang the app when it
is trying to exit.

See notes in the threading module's Thread.setDaemon
docs for background.

-Peter
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Thomas Steffen | last post by:
Hallo, here my code: .... (sin, souterr) = os.popen4(command) while 1: line = souterr.readline() print line if not line: break
8
by: bearophileHUGS | last post by:
Hello, I have four things to ask or to suggest, sorry if they seem basic or already discussed. ------------------- I am still ignorant about Tkinter. This little program, after pressing the...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
3
by: redneon | last post by:
I have a program which is constantly reading from a stream and what I'm wanting to do is, if the stream hasn't sent anything after a certain amount of time then do something. I've tried doing this...
2
by: Saurabh Sharma | last post by:
Hi I am using a Timer in the code. When ever the event elapses i populate a datagrid. Without timer it was working okay but i need timer coz of some constraints. After using timer whenever...
13
by: mark | last post by:
I have a sub which needs to do some things then wait a specified length of time before going on. I tried adding a timer with counter in its tick event then checking the state of the counter in the...
2
by: kimberly.walker | last post by:
I have a console application that calls 2 different delegates (Timers). The 1st Timer runs every 30 seconds this checks emails if there is an email it inserts the email into sql server. The other...
2
by: Amit Dedhia | last post by:
Hi I am developing a scientific application which has moderate level image processing involved. In my application, there is a main application form which invokes another form. When this form...
16
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.