> I've been warned that the if Fl::awake() enqueues data into a 
> queue of depth 1.  So if it's called more than once before 
> Fl::thread_message() is called, old messages will be lost.
> 
> However, the documentation for the function
>    int Fl::awake(void (*callback)(void*), void *userdata)
> says this:
> "The second form of awake() registers a function that will be 
> called by the main thread during the next message handling 
> cycle. awake() will return 0 if the callback function was 
> registered, and -1 if registration failed. Over a thousand 
> awake callbacks can be registered simultaneously."
> 
> Note the "Over a thousand..." comment in the last sentence.  
> So does that mean as long as I use the callback-version of 
> Fl::awake(), I don't have to worry about lost messages 
> (within reason)?

There are other forms of awake and note that awake() can be called with
no parameters at all, which I would hazard is the "usual" way to call
it.
So you only need to worry about what thread_message does IF you actually
want to recover messages from the queue using thread_message.

The fltk core handles the awake queue directly, and does not use
thread_message, so the "shallowness" of its buffer is not important to
the fltk core.

Most of the time, I call awake with no parameters, it just serves to
tell the main thread that something has been changed in the child thread
and needs redrawn. I've never really found a need to use thread_message
to recover info from the child thread in the main thread at all - but
then I have other IPC approaches anyway.

The form of awake where the child thread passes a callback to the main
thread, to be executed by the main thread, is also useful, but again
does not depend on thread_message.

Although, having typed that, I remember you are using 1.1.7, and that
mechanism may have been added since then. Have you looked at the
mechanisms provided in 1.1.9 for comparison - I do believe the later
versions are better.

In summary; I've never found need to use thread_message, so you may not
need to either. What is the problem you are trying to solve that needs
it? Is there some other way?

-- 
Ian


SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to