Re: Timer callbacks stall out (stop getting called)
- From: "Eric Livingston" <elivings clark net>
- To: <gtk-list redhat com>
- Subject: Re: Timer callbacks stall out (stop getting called)
- Date: Fri, 2 Jul 1999 08:20:41 -0400
| On Thu, 1 Jul 1999, Eric Livingston wrote:
| >
| > Can anyone tell me why this might be so? What in the gtk library handles
| > timeout function callbacks, and is there a way to troubleshoot this
area?
| >
|
| Well, it works by calling select() with a timeout, IIRC. Seems like
| someone would have noticed if that was broken. Perhaps the kernel release
| notes say something about select() behavior.
|
| If this was in a freshly-written program, I could guess wildly that the
| timeout incorrectly had a void return value; since a gint is expected, Gtk
| gets garbage. A non-zero return leaves the timeout in place, but sooner or
| later the garbage might happen to be 0. (OK, not likely but possible.)
|
| Havoc
Well, something's definately amiss with gtk, I'm thinking. I rechecked the
callback function, and it's reliably returning a TRUE (it's of type gint as
well). After several iterations of returning TRUE, it simply is no longer
called, while the rest of the program works fine (the non-time related
stuff...)
I took a look at select(), and things seem ok. I also tested a very small
program, below, that works reliably for extended periods of time, so I don't
think select() is itself the problem... something else is up.
------- select test program (from the man page example,
modified) -----------
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
int
main(void)
{
fd_set rfds;
struct timeval tv;
int retval;
while (1) {
tv.tv_sec = 1;
tv.tv_usec = 0;
FD_ZERO(&rfds);
FD_SET(0, &rfds);
retval = select(1, &rfds, NULL, NULL, &tv);
if (retval) {
printf("Done.\n");
break;
}
else {
printf("Hit any key to exit...\n");
}
}
exit(0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]