<meta http-equiv="content-type" content="text/html; charset=utf-8">Huh, 35 new messages in my topic :) . After reading all, maybe I summarize why I need post message to non-windowed object/component and why I can't use PostMessage and for what I need this (on a real example).<div>
<br></div><div>So, I wrote TMyHTTPClient which is some kind of layer for synapse http client but it do all jobs in thread. Simply structure:</div><div><br></div><div>type</div><div>  TMyHTTPClient = class;</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
<br></div><div>  TSynThread = class(TThread)</div><div>  private</div><div>    FMyHClient: TMyHTTPClient;</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>    FSynHTTP: THTTPSend;</div><div>  end;</div>
<div><br></div><div>  TMyHTTPClient = class</div><div>  private</div><div>    FSynThread: TSynThread;</div><div>  end;</div><div><br></div><div>Now, TSynThread communicate with TMyHTTPClient sending progress and response data from server. I used TThread.Synchronize() for this but I often had deadlocks because TMyHTTPClient cares about terminate and free thread (it waiting in destructor until thread terminate). I could not find way to omit deadlocks in case when thread blocking in synchronize() to send progress data and TMyHTTPClient waiting for this thread termination (ProcessMessages and CheckForSynchronize doesn't solve this on linux). So I tried solve this using PostMessage instead of Synchronize but PostMessage need window handle. In simple project, main form should be solution here (as <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; white-space: nowrap; ">mediator between </span>TMyHTTPClient and TSynThread) but my project is quite big and I use this http client in many places, in many modules, in many cases (most in non-visual) and in many instances. So I need something simpler. Now you reminded me about Application.QueueAsyncCall and this is point where we are :) . I think that critical section latency in thread is not problem in this case. I try update lazarus source and test your "thread safe" fix for QueueAsyncCall.</div>
<div>Maybe my case could be resolved in many different ways, but good communication mechanism between threads, certainly will be useful in other cases :)</div><div>Sorry for my bad english, I tried describe it in details.</div>
<div><br></div><div>Regards.</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8">