FLTK logo

Re: [fltk.general] Re: Window is frozen

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: Re: Window is frozen imm Nov 28, 2021  
 
On Sun, 28 Nov 2021, 20:46 supsm17 wrote:
As for lock and unlock, they kind of work? The window is very laggy and takes some time to update. After the thread finishes executing it appears that the window is completely frozen.

Hm, OK, I suspect this comes under the heading of "threads are hard", basically.

I'm on my phone, so can't really code up an example just now.
It would be helpful if you could post a minimal, compilable, example of what you are doing that manifests the failure state, so that we can advise on how to proceed.

This can (and should) work fine - that it does not tells us that there's something awry in your code, so we need to see what you are doing, so we can figure out what.
--
Ian
From my Fairphone FP3
   








On Sunday, November 28, 2021 at 3:43:51 AM UTC-8 Ian MacArthur wrote:

On Sun, 28 Nov 2021, 10:39 Manolo wrote:
To call Fl_Browser::add() from a worker thread, you have to call Fl::lock() before and Fl::unlock() after.
See an example of how it's done in demo program test/threads.
Also, make sure you follow guidelines given in :


Yes, as Manolo says, the crux is that the render context on WIN32 is basically single threaded and can only safely be accessed from the main thread of each process.

So to access rendering from a worker thread, you need to lock, or (better) use the FL::awake callback mechanism.


--
Ian
From my Fairphone FP3
  

--
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/930e721d-4742-41ba-9fb5-24bde3274b5en%40googlegroups.com.

--
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/CAGFM6dYjhRM3jGtQJ4f4L6kT1B-%3Df_J0G3V32-6YTuu%2BJZtTMA%40mail.gmail.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'.