> yes, opening a separate `Lua` thread would be fine. I 
> sometimes notice that when executing Lua code, the 
> programming language output window and the editor window do 
> not respond to anything for some seconds.

That was my worry - with everything in a single thread, the fltk widgets
will be unresponsive whenever the lua sections are working, so unless
you can arrange for the lua code to "pump" the fltk loop quite often, it
can make your app appear unresponsive.

You probably need to pump the fltk loop at around 15 to 20 times per
second to keep things looking responsive to the typical user.

If you can put the lua code into a subsidiary thread, then it becomes
the OS responsibility to keep both threads responsive...

> Thanks for the idea - I will try to implement it.

OK - there are some notes in the fltk-1.1.x docs about threading, but if
the main thread has all the fltk stuff in it, and the child thread has
all the lua stuff in it, you probably do not even need to deal with
thread synchronisation (i.e. if there are no fltk widgets accessed
directly in the lua thread, then you do not even have to use the
Fl::lock() and Fl::unlock() methods to sync the threads.)

The other thing I'd note is that it is better if the bulk of the fltk
code is in the "main" thread, as some platforms are sensitive to
accessing the graphics device from a subsidiary thread... In particular,
creating and deleting windows should be done in the main thread, as some
hosts will get confused if windows are created/deleted from a subsidiary
thread. (Though more recent OS versions are getting better at coping
with this, it seems!)




SELEX Galileo Ltd
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