XForms: Running multiple callback functions in parallel

Vinh (vkdang@eleceng.adelaide.edu.au)
Fri, 5 Feb 1999 12:11:18 +1030 (CST)

# To subscribers of the xforms list from Vinh <vkdang@eleceng.adelaide.edu.au> :

Hello

I was wondering if it was possible to have two call back functions running
at the same time?

As part of a program I am writing, I have two buttons called "Start" and
"Stop" with their respective callback functions "start_call" and
"stop_call".

I use the stop_call function to set a global variable of type int (which
I'll call halt_now) to 1.

The start_call function contains a loop which reads data in from a very
large input file. Before the end of the loop, the halt_now variable is
checked to see if it is 1, and if it is, the start_call function exits.

When I run this program, it seems that once the Start button is pressed,
the start_call function is executed (which takes a long time) however all
other buttons/input fields on the form are inactive and the Start button
remains highlighted (as it is when the mouse is moved over it).

Is there a way that I can get multiple callback functions running at the
same time? Below is some code I used

Any help would be appreciated, Thanks.
vkd

int halt_now = 0;
FILE *fp;
unsigned long v;

void start_call(FL_OBJECT *w, long q)
{
if ((fp = fopen("input_file", "r")) != NULL)
{
while (fscanf(fp, "%08x", &v) != NULL)
{
/* some code here */

if (halt_now)
{
fclose(fp);
return;
}
}
}
}

void stop_call(FL_OBJECT *w, long q)
{
halt_now = 1;
}

_________________________________________________
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/