[fpc-devel] Delphi's current TThread implementation

Sven Barth pascaldragon at googlemail.com
Sun Dec 16 17:41:09 CET 2012


Hello together!

I'm currently working on bringing FPC's TThread implementation up to par 
with XE3's, but while the wiki of Embarcadero is a very important source 
of information I can't get everything I need from it. Thus I'd like to 
ask someone with access to XE3's source code (or maybe also older 
versions; so please write which version you used :) ) to describe (not 
copy!!!) how the following methods/functions are implemented:

CheckSynchronize (in respect to entries queued by TThread.Queue; see below)
TThread.CurrentThread (or more precise: TThread.GetCurrentThread)
TThread.GetIsSingleProcessor (I suspect it's just a "Result := 
FProcessorCount = 1")
TThread.SpinWait
TThread.TerminatedSet
TThread.CheckThreadError
TThread.NameThreadForDebugging (I don't think that we'll implement that, 
but I'm curious ;) )

Some further questions regarding Delphi's threading implementation:

Does CheckSynchronize walk the whole queue or just a specific amount?
What does CheckSynchronize do if an exception happens in one of the 
queued methods?
Does TThread.CurrentThread return something for externally created threads?
Where/How is TThread.FExternalThread set?
Where/How is TThread.FProcessorCount set?
Is RemoveQueuedMethods called if the thread terminates?

Regards,
Sven



More information about the fpc-devel mailing list