|
|
I have tried to use Fl::awake, however printing still doesn't really work from worker threads. Here is what happens: I can print successfully from main thread When I try to print from worker thread, the first time it prints, but then the thread disappears? The printing is done and appears on the screen, but the thread itself does not do anything else and does not appear in the call stack
My callback function looks like this: void print(void* v) { ui->output->add(static_cast<char*>(v)); } 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/fa3508bf-c579-4c5d-83dc-dcd31bdcf8ffn%40googlegroups.com.
[ Direct Link to Message ] | |
|
| |