Re: [fltk.general] Use worker thread to call Fl_Window and Fl_run

GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
Previous Message ]New Message | Reply ]Next Message ]

Re: Use worker thread to call Fl_Window and Fl_run "anmol.... 04:24 Oct 25 top right image
Could Ian and Greg kindly comment on main_gui_on_secondary.cpp ? This program uses fl_create_thread and the worker thread starts the progress window and calls Fl::run().

In the docs this is forbidden.

Don't call Fl::run(), Fl::wait(), Fl::flush(), Fl::check() or any related methods that will handle system messages from a worker thread

Why is this working ? From my example, (no longer a progress bar but a more complex UI), I get a crash when the user closes the window if started from a worker thread.

On Friday, October 2, 2020 at 2:49:42 AM UTC+5:30 wrote:
As requested, I'm attaching a sample of my message based thing. Updates the progress bar once a second.

Probably not useful to the OP, as it uses a secondary thread. Also probably not the best example, as I've not tried Ian's suggestion of Fl::awake.

Variant 1: main_gui_on_main.cpp : GUI is running on the main thread, work in secondary thread
Variant 2: main_gui_on_secondary.cpp : Work is performed on main thread, GUI is running on a secondary thread.

You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Direct Link to Message ]
bottom left image   bottom right image
Previous Message ]New Message | Reply ]Next Message ]

Comments are owned by the poster. All other content is copyright 1998-2020 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.