[fpc-devel] Comparison FPC 2.6.2 - Delphi 7
Michael Schnell
mschnell at lumino.de
Wed Mar 6 12:25:04 CET 2013
On 03/06/2013 11:45 AM, Florian Klaempfl wrote:
>> So (as with all x86 variants) no library
>> or system call is necessary.
>
> Wrong. This is not true in the general case, please read the
> appropriate api documents.
I do know that on Windows it's documented like this by Microsoft. But I
also know that the Microsoft C compiler (and AFAIK, gnu as well) does
not adhere to that documentation but simply uses the appropriate
selector register that the Intel chip designers happily provided for
such kind of purpose. (We already discussed this here some years ago.)
>
> Wrong. On linux this can be done by a jump to a certain adress.
OK. I did not thoroughly enough check into this. Does the jump to the
system region automatically provide the mode switch without changing
anything in the MMU (and this without the necessity to invalid the cache) ?
If yes a glibc library call might provide a noticeable overhead and it
might be advantageous to do the system call directly in the RTL.
>
> And how does one the "current" TThread?
Do you mean something like this:
Type
TMyThread = class(TThread)
private
currentthread: Integer;
end.
var
threads: array[1..100] of TMyThread;
for i := 1 to 100 do begin
thread[i] := TMyThread.Create;
thread[i].currentthread := i;
end;
TMyThread.Execute;
var
s: String;
begin
s := 'I am ' + InToString(currentthread);
end;
?
-Michael
More information about the fpc-devel
mailing list