I am using Linux Gtk2 here ...
Is there a problem with SendMessage? I am using LCLIntf.SendMessage to synchronize a method invocation which touches the ui from a background thread. The problem is when my message is handled, the message handler isn't in the correct thread context. That is 'procedure LMRender(var Msg: TLMessage); message LM_RENDER;' is not invoked in the ui thread. Why?
Only one thread in an application should call LCL APIs, usually the main thread. Other threads can make use of the LCL through a number of indirect methods, one good option being the usage of SendMessage
And at http://lazarus-ccr.sourceforge.net/docs/lcl/lclintf/postmessage.html
This method is a thread-safe solution to send messages to windows. Those messages will be handled in the message loop of the application and therefore can be sent from any thread.
"the message loop of the application" should be the same thread context as the ui thread.
