> > Which fltk variant?
> Can you please be more specific? What does it mean fltk variant?
> I use FLTK 1.1.9.

That is the answer to the question.
Other valid answers might be fltk-1.3.x, fltk-1.1.6, fltk-2, etc...



> There are parts of my code below.

Unfortunately you haven't really shown us enough context to make sense
of what you have shown, but I'll take a stab at some answers anyway...


> main function program entry point -> main.cpp

This is inside the function "int main(int argc, char **argv)" ? If so,
then it is the "main" thread.

> I don't understand. Do I cal for fltk thread as main thread here?
> //do some initialization and then
> /**=============================== START GUI ======================*/
>   Fl::lock();
>   std::cout << "\n => STARTING GUI\n";
>   Fl::visual(FL_DOUBLE|FL_RGB8);
>   mainReturn = Fl::run();
>   Fl::unlock();

This unlock is not necessary.

Once the main thread has acquired its first lock, it will manage its
thread locking automatically. 
Only subsidiary threads need to manage their locks explicitly. So, once
you have acquired the first lock in the main thread at startup, you must
*never* manipulate the locks in the main thread yourself, you must let
fltk do it.

All your subsidiary threads *do* have to explicitly manage their locks,
however. This is discussed in the documentation.



> This is from cnc_gui.fl
> Here it calls mngr thread
> 
> // START COMMAND MANAGER THREAD:
> memset(savedPosCoords, 0, sizeof(geom_data) * 
> axesNum2NameConformity::axesQuantity());
> if ((msg_num = commandManager.run()) != MSG_NO_ERROR)
> {
>   printf("\n *** %s ***\n", msg.getString(msg_num));
>   return;
> }
> else printf("\n COMMAND MANAGER STARTED\n");
> last_coords_focus = 0;
> offscreen_buf = 0;
> pict_num = 0;

No idea what this is. This isn't fltk code...



> // SET TIME VALUE REMAINING TO THE PROCESS END
>  Fl::lock();
> char str[32];
> unsigned long hours = (unsigned long) (RemainedTime / 3600.0);
> unsigned long minutes = (unsigned long) ((RemainedTime - 
> ((double) hours) * 3600.0) / 60.0);
> unsigned long seconds = (unsigned long) (RemainedTime - 
> ((double) hours) * 3600.0 - ((double) minutes) * 60.0);
> sprintf(str, "%lu:%02lu:%02lu", hours, minutes, seconds);
> time2end->value(str);
> Fl::unlock();
> Fl::flush();

If this code is in a subsidiary thread, it must not call Fl::flush(). It
should call Fl::awake() instead.

If this code is in the main thread, it must not call lock/unlock.

Either way, there is something wrong with that code that you must fix.



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