On 19.07.2010, at 06:01, dimatura wrote:

> 
>> If you need to do some really *looong* processing, don't do it from a
>> callback, find some other way to manage it (I usually spin of a worker
>> thread) to ensure that the GUI stays alive.
>> 
> 
> Thanks for the answer. By the way, what do you use for threads? It seems FLTK 
> doesn't have most of the things you'd usually use with threads, like locks, 
> monitors, etc.

We decided to keep multithreading out of the library because we felt that there 
are many other libraries out there that provide perfectly fine cross-platform 
multithreading.

The FLTK interface is limited to Fl::lock()/Fl::unlock() which is automatically 
called during callbacks, so you only need to call this when doing UI stuff from 
other threads. The usual order of calls is (this would be from another thread):

Fl::lock();
myOutput->value("Hello");
myOutput->redraw();
Fl::unlock();
Fl::awake();

You can not create or destroy windows from another thread. This is a limitation 
of one of the underlying OS's.

But there is a nifty shortcut when you need to call a function in the main 
thread from another thread: Fl::awake(someFunction, someValue);

- Matthias
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to