Re: XForms: are xforms routines reentrant?

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 18 Mar 98 10:09:27 PST

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> evening,
> in my signal(2) handleri call the follwing
> functions:
> fl_addto_browser, fl_show_form, fl_gettext_width and
> some other xforms routines. One of the books i use (R.W.Stephens)lists
> functions that may be used in signal handlers and says all others
> (e.g. funcs calling for example malloc(2)) shouldnt be called.
>
> IS it safe to use these xforms routines?

No, you should never call an XForms or pretty much any other function
not in the list given in Stevens in a signal handler. Since you have
no idea what's been interrupted when the signal pops, you are liable
to walk on something.

If you need to catch signals, you should use the XForms signal
callback. If you use the signal callback, you can do pretty much
anything you want to in it without fear of breaking something. The
reason for this is that the callback is not invoked directly from the
actual signal handler. The actual signal handler just sets an
internal flag for XForms that tells the event loop that the signal has
occurred. When the event loop processes this flag, all normal context
has been restored and all normal functions and system calls are
available.

Refer to the section on Signals in the appendices (Section A.6 in my
0.88 manual).

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/