# To subscribers of the xforms list from Ger Lawlor <gerard.lawlor@kapookigames.com> :
I've just started using Xforms on Solaris.
My application is multithreaded and part of the code is as follows,
main()
{
/* Xforms initialization code */
FD_lg_redir *lg_gui;
lg_gui = (FD_lg_redir *)malloc(sizeof(FD_lg_redir));
fl_initialize(........);
lg_gui = create_form_lg_redir()
fl_show_form(lg_gui->lg_redir,....);
.....
....
...
../* Thread creation code */
#ifdef _POSIX
pthread_create(.......,new_thread, (void *)lg_gui,....);
#else
thr_create(.........,new_thread, (void *)lg_gui,.....);
#endif
fl_addto_browser(lg_gui->lg_status_br,....);
fl_addto_browser(lg_gui->lg_status_br,....); <<<<<====== cause of
problem
}
void *new_thread(void * args)
{
FD_lg_redir *lg_gui = (FD_lg_redir *)args;
....
....
...
..
.
fl_addto_browser(lg_gui->lg_status_br, .....);
....
...
..
}
The segmentation fault i get is on the second addto_browser call in
main().
The stack trace is as follows,
#0 0xff197270 in draw_textline ()
(gdb) where
#0 0xff197270 in draw_textline ()
#1 0xff197a14 in draw_textbox ()
#2 0xff198aac in handle_textbox ()
#3 0xff17c984 in fl_handle_it ()
#4 0xff17ca6c in fl_handle_object ()
#5 0xff17c030 in redraw_marked ()
#6 0xff1991e4 in fl_addto_textbox ()
#7 0xff123810 in fl_addto_browser ()
#8 0x12618 in main (argc=1, argv=0xffbef34c) at line XX in YY.c
The question i would first like to ask is, whether Xforms is
mutlithreaded or not, i cannot find details anywhere in the
documentation.
If not it seems to be possible that on the call to fl_addto_browser in
main() the function is also called from within the new thread and
possibly
the function because it may not be reentrant causes a segmentation
fault. Anyone able to give me some information on this.
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://world.std.com/~xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/
This archive was generated by hypermail 2b29 : Tue Oct 31 2000 - 10:37:21 EST