Patrick, this list is meant for discussing development of fltk, not for developers using fltk, so you might get more feedback if you post over in fltk-general, where this type of thing is usually handled.
I've added some more comments later on that might help... On 21 Aug 2009, at 14:34, Patrick wrote: > The code is written in C. C, C++, whatever, it is all the same! :-) > If i get a message the printf with the much ***** is comming ok but > afterwards the program chrashes... I don't think it crashes, or at least not on this Mac. It does hang forever though, which might look lot like a crash.. > What is the problem with my code? Can somebody help me? Did you try running it through GDB? That would surely point you to the source of the "crash". My guess goes like this: You have called msgrcv() in your callback method, but you have not set it for IPC_NOWAIT, so it will block the callback method. And if you block the callback, you block the whole fltk event loop, causing your program to stall. I assume that is what you are seeing? In general, if I were using message queues, what I would do would be one of: - Set the queue non-blocking so that the msgrcv() in the callback returns straight away if there are no messages pending, then handle the return code accordingly. - Set the queue blocking (the default) but start a worker thread to handle the queue interface. - Set the queue non-blocking and poll it from a timer callback set using Fl::add_timeout(). However, what I would actually do in real life is *not* use message queues at all, instead I would do the IPC over a pipe or a socket, and then simply have Fl::add_fd() handle the i/o for me, which is way simpler and more flexible. If you use the socket approach you get the instant-win that the exact same code also works on win32 and other host and you can make the IPC work over the network too... -- Ian _______________________________________________ fltk-dev mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-dev
