On 09/19/2014 11:20 AM, Xiangrong Fang wrote:
Hi,
In a previous email asking about PostMessage, Michael suggested I used
QueueAsyncCall instead,
In fact now that I know what you are trying to accomplish (a Thread
Pool) I take back the suggestion of QueueAsyncCall, as same is supported
by Lazarus (LCL) and not directly by fpc (RTL). As I feel that a
ThreadPool should be working independently of the GUI, I would use
TThread.Synchronize or TThread.Queue.
In fact I did a TThreadPool component that works nicely for me. This is
discussed in the Lazarus Forum (even though I think it should better be
discussed here, as it does not use any Lazarus features.
My question is, why cannot Lazarus just use PostMessage, but invent
the QueueAsyncCall() method?
Windows is a "Message driven" OS. This might be nice but other OSes
don't support or force this paradigm.
As fpc is supposed to be as portable as possible, it can't work "Message
driven" under the hood, which is not supported by other OSes.
To support Code ported from Delphi, "PostMessage" is provided by Lazarus
in the LCL (but AFAIK, not by fpc, which can be used without Lazarus / LCL)
-Michael
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal