DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2359
Version: 2.0-current


[V 1 users, there's a note about the "lock" function below that 
you should see if you want your threads to behave properly.]

V2 user!  Here's the solution to your server crash.

The TabGroup cpu time hogging problem...

TabGroup will loop like crazy drawing and redrawing the overlay 
whether it needs it or not until you manage to put a child widget
in it.  This only happens when the overlay is visible.

Solution?  Force the overlay drawing function in fluid to 
time-share with the operating system instead of hogging time
(possibly due to TabGroups also being the window that is called by calling
itself below).

In WindowType.cxx around line 43 add

  #include <unistd.h> // pause for cpu time sharing for empty TabGroup
<-rs

and around line line 163 where you see...
  void Overlay_Window::draw_overlay() {
add...
    // TabGroup was hogging cpu time rs->
    usleep(1000); // share time with operating system, 1 uS even works.
above this...
    window->draw_overlay();
  }

That is a one millisecond delay.  It also works with a 1 microsecond delay
on my machine, but I'm not sure if all operating systems will honor a 1
microsecond delay.  Mine does.  

(Note to dev.  I have verfied that the window being called to draw 
overlay is not the TabGroup window itself, so this is it for now.)

--------------------------------------------------------

I'd also VERY STRONGLY recommend anyone and everyone to add a 1 
microsecond (really only one) to the thread lock function. This was 
an issue with version 1 as well, but if you missed that post or
if it hasn't been addressed in the latest rev of version 1, you 
do do it yourself quite easily if you still have the installation
files.

Here's where I inserted the code in version 2.

  void fltk::lock() {usleep(1); init_or_lock_function();}

And voila!  Your multi-threads now behave properly instead of hogging
cpu time and causing the queue to misfire. :-)

That function is in lock.cxx in version 2, possibly in Fl.cxx in ver 1.

Then run the thread test in either version and compare to previous 
runs.


Link: http://www.fltk.org/str.php?L2359
Version: 2.0-current

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

Reply via email to