[fpc-pascal] GetCurrentThreadID under FreeBSD vs Linux

Graeme Geldenhuys graeme at geldenhuys.co.uk
Sat Feb 9 01:00:30 CET 2013


On 2013-02-08 20:34, Marco van de Voort wrote:
>> Navigating the code to see how TThreadID is defined, I found this for
>> FreeBSD.
>>
>>   TThreadRec = record end;
>>   TThreadID  = ^TThreadRec;
>>
>> So TThreadID is just a pointer to a record structure
> 
> This is a common construct to define opague types.

Sorry if my message wasn't clear. I fully understand that, and wasn't
implying that FPC (FreeBSD) was wrong here. After my previous FreeBSD
messages and feedback, I knew where to look for the info, and the man
pages clearly said it is an opaque type.


>> [Info from Google searches].  Under FreeBSD it seems that naming each
>> thread with a string value is a more supported solution.
> 
> Note that under Windows threads can be named on API level too. VS and Delphi
> (2010+ iirc) will show such threads in the debugger with a familiar name.

As far as I know (I could be wrong though) Linux can't name threads. And
again, the code I'm working on in tiOPF is cross platform and cross
compiler.

As I said, the Thread ID info is only used for debugging and not
something critical. There must just be some value differentiating
between various threads, when they output to the logger.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/




More information about the fpc-pascal mailing list