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 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 Paul Hahn Sep 30, 2020  
 
So if you can create and show all the window objects in your main thread, then arrange for Fl::wait() to be called periodically from the main thread, that ought to just about do the job.
 
Yes I did that when I wrote an animated "wait window widget" based on a threading solution. A lot of bad things happened unexpectedly until I finally got a handle on how to deal with ensuring FLTK updates happen only in the main thread.

In retrospect, all my initial problems were due to not respecting the FLTK documentned warning to use their lock mechanism for multi-threaded solutions. I definitely respect that now, even though I wound up probably sort of duplicating what it does in my own way (i.e., my own version of Fl::run() and Fl::awake() only implemented with Bohm-atomic "mutexes"). I would utilize the FLTK locking mechanism if I had to do it all over again.

--
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/72bdabab-b603-4260-a8fe-f17f1b4f2dc9n%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-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.