FLTK logo

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

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Library      Forums      Links      Apps     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.... Oct 25, 2020  
 
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 lifeatt...@gmail.com 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 fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/f621d0dc-988e-4f5b-8d74-5aadea981b53n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

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