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 Ian MacArthur Oct 01, 2020  
 
On 1 Oct 2020, at 19:47, lifeattickville wrote:
> 
> > The "historical" model for GUI programs is the main process is the GUI handler thread, and if there is significant, potentially blocking activity, it takes place in secondary threads. 
> 
> Tho, thinking about it for 5 seconds, I don't see why the GUI thread couldn't be a secondary thread ... 


Because, historically, the GPU context belongs only to the main thread, and historically GPU drivers were a very long way from being thread-safe.

Remember that for folks writing GPU drivers the mantra was *never*  “do not be wrong” it was always “do not be slow.”

Things have got a bit better in recent years, particularly since the games houses started trying to use all those extra cores - that has somewhat forced the GPU folks to clean up their act a bit, so things *can* work like that now. On some machines. With some GPU drivers.

But generally, if you want your code to be robust and portable, don’t try and manipulate the GUI context from a non-main thread. It may not be convenient, but it less painful in the long term!

I have, more than once, had to dig folks out of a hole of their own making, for this exact issue - they had code that worked “perfectly" on their dev machine, using a  non-main GUI context, and then burned in inexplicable bug-ridden fury when run on a user machine.

Maybe someday that will be fine. But not yet...

-- 
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/4786FC5E-CF0C-4AF5-B56E-B17AC49C058E%40gmail.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'.