Re: [gtk-list] can timers interrupt my code?
- From: Paul Barton-Davis <pbd op net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] can timers interrupt my code?
- Date: Wed, 02 Feb 2000 12:59:09 -0500
>Do timeout callbacks interrupt drawing code? I mean, in my configure
>callback (e.g.), do I need to worry about the drawing code being
>interrupted by a timeout which shares some data?
>Same for input functions?
>GGAD isn't explicit on this (sorry if I missed it), but it describes
>both of these under 'The Main Loop', which implies that they are run
>from the main loop, and not completely asynchronously.
They are called completely synchronously. the glib main loop simply
sets the select/poll timeout so that we will return at the "right"
time if there are no input events. By the same token, if drawing code
or other event-driven code take too long to return control to the main
loop, then your timeout function won't be called "on time".
This is one reason why using glib-based timeouts is inadequate if
timer resolution is important to you. In that case, you need to use,
for example, sigitimer(), and that will cause the execution of a
function that will interrupt drawing code. I tend to use
... body of SIGALRM handler ...
in such code, even if I don't think I'm going to trample on any
glib/gdk/gtk functions or variables.
] [Thread Prev