[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [XForms] I/O callback vs. Idle callback
From: |
Jens Thoms Toerring |
Subject: |
Re: [XForms] I/O callback vs. Idle callback |
Date: |
Sat, 27 Aug 2011 12:46:35 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi Michal,
On Sat, Aug 27, 2011 at 08:08:02AM +0200, Michal Szymanski wrote:
> Trying to debug some sporadic mis-behavior of my telescope control
> system (written with XForms, of course :) I have got to a following
> question:
>
> The app does pretty many things in an idle callback, refreshing data
> displayed in various text boxes and windows, executing observing scripts
> etc. It also reads data from two sockets, using I/O callbacks. The
> "idle" maintenance includes also servicing data got from the sockets.
> Does XForms library ensure that IO and idle callbacks cannot interfere?
> (e.g. IO callback being invoked while the idle callback is
> running). I guess/hope it does but just wanted to make sure.
I think that you don't have to worry. Things work about this
way: whenever there are no X events (or after each tenth X
event to avoid never getting to it when there are lots of X
events arriving all of the time) fli_handle_idling() is cal-
led. First I/O channels registered with fl_add_io_callback()
are checked for and, if one or more of them are ready, the
corresponding callbacks are executed. Then callbacks installed
for signals are invoked (if there was a signal). And only after-
wards an idle callback (if installed) is invoked and during
that time no "background activity" from XForms is happening.
The only way you might get into problems as far as I can see
at the moment would be if you would call from within the idle
callback one of these functions
fl_check_forms()
fl_check_only_forms()
fl_do_forms()
fl_do_only_forms()
since they check for X events and in the process may also trigger
execution of the IO and idle callbacks. That's something I only
realized now after your question and which probably should be
corrected (I just don't know yet in which way this is to be done
best - one might either flag an error when they are invoked from
a callback or one might skip invoking callbacks when one is al-
ready within a callback).
Best regards, Jens
--
\ Jens Thoms Toerring ________ address@hidden
\_______________________________ http://toerring.de