About the Fl::lock() call to initialize threading support

46 views
Skip to first unread message

Manolo

unread,
Feb 26, 2026, 2:59:28 AMFeb 26
to fltk.coredev
Among many other changes, commit eadea6a (dated 19 jun 2025)
added a detail to the documentation of Fl::lock() in FLTK 1.5 
that the Fl::lock() call to initialize threading support should be done
"before any windows are shown".

The test program that showcases FLTK threading support, threads,
calls Fl::lock() after its two windows have been show()'n.
This program runs OK.

Why was "before any windows are shown" added to the documentation?


imacarthur

unread,
Mar 7, 2026, 5:29:03 AM (5 days ago) Mar 7
to fltk.coredev
Manolo,

Did you get anywhere with this?
I don't know why the docs are this way - but then it is also stating a thing that I have long believed is true.
So... I believe it is true, but I don't have any actual evidence that is actually is.
There might be weird effects with event delivery if the events queue is not initially locked, when subsidiary threads are running, but how closely that relates to the first window being shown may depend very much on the application in question, I think.

So I have nothing useful to offer here.
(That said, I'm going to go on doing that first lock really early in my code anyway!)

Cheers,

Ian

Bill Spitzak

unread,
Mar 9, 2026, 1:20:06 PM (3 days ago) Mar 9
to fltkc...@googlegroups.com
I think the real rule is that you must call Fl::lock() in the main thread before any other thread calls it. You can run fltk single-threaded for as long as you want before this.


--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/fltkcoredev/fc5cbd27-3152-4521-ad6d-40c03cf83b10n%40googlegroups.com.

Manolo

unread,
Mar 11, 2026, 3:17:36 AM (yesterday) Mar 11
to fltk.coredev
Le lundi 9 mars 2026 à 18:20:06 UTC+1, spi...@gmail.com a écrit :
I think the real rule is that you must call Fl::lock() in the main thread before any other thread calls it. You can run fltk single-threaded for as long as you want before this.

Thanks Bill.
That's what I think too. Therefore I'd like Matthias to detail why he added the condition "call Fl::lock() before 
the first window show() operation" to the documentation.
Reply all
Reply to author
Forward
0 new messages