On 7/6/21 10:34 PM Bill Spitzak wrote:
I'm pretty certain that Fl::awake(void* message) is
exactly the same as Fl::awake(F, message) where F is a
"Fl_Awake_Handler" that is internal to fltk. Basically it does
not conflict or have any problems different from any other
implementation of an Fl_Awake_Handler. This one just stores
message in a static variable.
The static variable is the problem, independent of any
interaction or incompatibility with the other form of Fl::awake().
Since there is only one static variable callling
Fl::thread_message() later in user code can only retrieve the last
value assigned to this variable. Hence Fl::awake(void*
message) is IMHO always unreliable unless you know that messages are
queued infrequently, i.e. less than can be handled by events. A user
moving the mouse permanently would likely lead to an "event
overflow" dropping messages, whereas Fl::awake(F, message) queues
all messages so no message can ever be lost.
On Mon, Jul 5, 2021 at 12:33
PM Albrecht Schlosser <...
Despite the warning in the docs I believe that using Fl::awake(Fl_Awake_Handler
cb, void* userdata)
is always "on the safe side". As
Ian wrote already, the warning may be from an older part of
I believe the warning is platform independent and the part
"on some platforms" can probably be removed. I would add
is always kinda unreliable
cb, void* userdata)
is always reliable as long as you
don't use the same userdata pointer during the lifetime of
such an Fl::awake() request. With "lifetime" I mean the time
from writing to the memory pointed to by userdata until it
is processed by the awake handler. This is the essential
The docs of Fl::awake(void*
say: "The default message handler saves the
last message which can be accessed using the Fl::thread_message()
function." This means that there is only one (likely static)
storage location which will be overwritten if you call Fl::awake(void*
more frequently than the awake call can be
serviced. This will drop all intermediate messages and only
the last message can ever be retrieved by the user program
Hence, the user program is responsible for not calling Fl::awake(void*
more often than can be serviced by the FLTK
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 email@example.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/74a7eec6-89d9-3d14-4005-755cfca32956%40online.de.
[ Direct Link to Message ]