Hello,

I'm doing a small project that needs to use threads.h and I have it mostly 
working. Having never written threaded programs, I have a question about 
Fl_Button and fl_create_thread.

I'd like a thread to be created when the user clicks a button. So, would I put 
fl_create_thread in the callback function like so:

void * mycallback(void * userdata)
{

// Make a big file.
?? fl_create_thread();

}

Right now, I have that in main like so (just for testing):

Fl_Button *gen = new FL_Button(0,0,0,0, "&Generate");

Fl::Lock();

Fl_Thread make_file;

fl_create_thread(make_file, mycallback, gen);

Fl::run();

So the button is there, but it doesn't do anything in my test code. The program 
starts the thread when it first executes as I expect it would. The thread seems 
to be working as it makes the big file and the GUI is still responsive and 
functioning to other buttons, I can close it, etc.

Any advice on how to make the button start the thread would be appreciated.

Tom
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to