> > On 11.11.2010, at 17:36, <[email protected]> = > <[email protected]> wrote: > > > Hello, > > What is the best way to add a delay function in a thread created with = > fl_create_thread for FLTK 1.1.8 under win32? I'd like the GUI response = > to run smoothly even when the delay is running. > >=20 > > I need the delays to be in the 20ms-200ms range and it's not critical = > to be accurate. The goal of the delay is just not to make the CPU give = > all its processing power in a while loop. > >=20 > >=20 > > I experimented with SleepEx() in the fct_with_loop and don't = > understand totally how come it affects threads other than the one it is = > in.In my bigger program, I created before running fct_wit_loop and the = > GUI response is pretty sluggish. > >=20 > >=20 > >=20 > > Thanks, > > Frank > > Hmm, there is not much threading support in FLTK because there are so = > many other threading libraries out there. > > FLTK has a timer function, Fl::ad_timeout and Fl::repeat_timeout that = > may help you, but those are not made for multithreading You could still = > use them to set locks, etc. .
> FLTK 1.1.10 and FLTK 1.3 have a function that can be called from a = > thread and runs a function in the GUI thread: Fl::awake() with two = > arguments (callback and user data) > > - Matthias= > Matthias, Thanks for your awake() suggestion. I don't understand, but you have enlightened me a little to the awake(). I need the delay not it the original GUI thread, but the band new thread. I saw in some places in the forum, I saw a recommendation to do lock() awake() unlock(). I have it in my big program in the lock() unlock() awake() order and if I change it to the recommended way, my program freezes. The add_timeout works on whole seconds. I am going to revisit the concept and see if I can modify the algorithm to do the delay in a chunk of one second, instead of looping multiple times and asking less than one second. Frank _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

