[fpc-devel] TThread.Queue again

Michael Schnell mschnell at lumino.de
Fri Nov 23 11:38:03 CET 2012


Hi FPC team,

Unfortunately I never got an answer to the message below.

Some minutes ago I did a little support for a colleague of mine, who 
uses Delphi XE2 (which I don't know very well, as I still work with the 
free "Turbo Delphi").

Here I found that the *TThread.Queue* function now in fact is fully 
supported and documented (but it has been slightly modified/enhanced 
regarding the times of my "Turbo". ) Thus finally Delphi Users can queue 
events for the main thread without needing to use the clumsy and 
unportable Windows messages stuff.

The class function TThread.Queue with a single parameter now is defined 
as *protected* and thus is only usable with derived classes, which does 
make sense, as here you normally are within the execute procedure of a 
user TThread object and supposedly will not want to define another 
thread as being the currently running.

As with Turbo Delphi the class function TThread.Queue with two 
parameters can be used. The first Parameter seemingly should give the 
TThread instance that is associated with the current (running) threads, 
but also *NIL* can be given, which in fact is the same as calling 
TThread.Queue with a single Parameter. (Turbo Delphi used " self" to 
denote the current thread, XE tries to find the running thread 
with*TThread.CurrentThread*).

(The class-function TThread.CurrentThread also is new and might be prone 
to be implemented in the RTL..)

So I understand that TThread.Queue has "arrived" in Delphi and it should 
be made available in FPC, as well (this can't be done by the Lazarus 
team, as TThread is defined in the RTL). This could be done by a simple 
call to *Application.QueueAsyncCall*, but supposedly a less 
Lazarus-depending implementation (similar to TThread.Synchronize or even 
using TThread.Synchronize, as Delphi does) would be more appropriate.

-Michael



On 11/13/2012 09:35 AM, Michael Schnell wrote:
> I already mentioned this some time ago, but I don't know if this issue 
> is already turned down and/or if it makes sense to create another 
> entry in Mantis.
>
> I feel it makes sense to add the (in Delphi 7 existing bun 
> undocumented) TThread.Queue() procedure and/or the last parameter ( 
> "QueueEvent: Boolean = False" ), D7 provides with TThread.Synchronize.
>
> (Of course I do like  the more portable "Application.QueuAsyncCall" 
> workalike a lot better, but Lazarus at al can't implement this Delphi 
> compatible Stuff unless provided by the RTL.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20121123/35acfd46/attachment.html>


More information about the fpc-devel mailing list