Re: fl_do_forms() and signals

Steve Lamont (spl@szechuan.ucsd.edu)
Mon, 17 Mar 97 07:00:11 PST

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

> In my multithreaded program, I'm using one thread for all libforms-calls.
> This thread is most of the time in fl_do_forms(), but if another thread
> has to do some output, I'm sending a SIGUSR1 to the first thread. This
> one then starts fl_addto_browser() or fl_set_button() - but sometimes
> the thread stops in fl_addto_browser()/fl_set_button().

It depends upon what you're doing in the signal handler. If you're
trying to call Xforms routines, you're probably going to lose
eventually. This is because the signal may have interrupted a system
call or some critical Xforms function. Trying to make Xforms calls in
such a case will most likely disarrange things terribly and cause your
program to either hang or dump core.

What you want to do is to register a signal handler with
fl_add_signal_callback(). When a signal arrives, Xforms will log it
internally and dispatch the signal handler.

Refer to the section on Signals in Appendix A for all the details.

Stevens, _Advanced Programming in the UNIX Environment_, discusses
signals and system call interaction in some detail, I believe.

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/xforms-archive/